1pub const JSC_OBJC_API_ENABLED: u32 = 0;
4#[repr(C)]
5#[derive(Debug, Copy, Clone)]
6pub struct OpaqueJSContextGroup {
7 _unused: [u8; 0],
8}
9#[doc = " @typedef JSContextGroupRef A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects."]
10pub type JSContextGroupRef = *const OpaqueJSContextGroup;
11#[repr(C)]
12#[derive(Debug, Copy, Clone)]
13pub struct OpaqueJSContext {
14 _unused: [u8; 0],
15}
16#[doc = " @typedef JSContextRef A JavaScript execution context. Holds the global object and other execution state."]
17pub type JSContextRef = *const OpaqueJSContext;
18#[doc = " @typedef JSGlobalContextRef A global JavaScript execution context. A JSGlobalContext is a JSContext."]
19pub type JSGlobalContextRef = *mut OpaqueJSContext;
20#[repr(C)]
21#[derive(Debug, Copy, Clone)]
22pub struct OpaqueJSString {
23 _unused: [u8; 0],
24}
25#[doc = " @typedef JSStringRef A UTF16 character buffer. The fundamental string representation in JavaScript."]
26pub type JSStringRef = *mut OpaqueJSString;
27#[repr(C)]
28#[derive(Debug, Copy, Clone)]
29pub struct OpaqueJSClass {
30 _unused: [u8; 0],
31}
32#[doc = " @typedef JSClassRef A JavaScript class. Used with JSObjectMake to construct objects with custom behavior."]
33pub type JSClassRef = *mut OpaqueJSClass;
34#[repr(C)]
35#[derive(Debug, Copy, Clone)]
36pub struct OpaqueJSPropertyNameArray {
37 _unused: [u8; 0],
38}
39#[doc = " @typedef JSPropertyNameArrayRef An array of JavaScript property names."]
40pub type JSPropertyNameArrayRef = *mut OpaqueJSPropertyNameArray;
41#[repr(C)]
42#[derive(Debug, Copy, Clone)]
43pub struct OpaqueJSPropertyNameAccumulator {
44 _unused: [u8; 0],
45}
46#[doc = " @typedef JSPropertyNameAccumulatorRef An ordered set used to collect the names of a JavaScript object's properties."]
47pub type JSPropertyNameAccumulatorRef = *mut OpaqueJSPropertyNameAccumulator;
48#[doc = " @typedef JSTypedArrayBytesDeallocator A function used to deallocate bytes passed to a Typed Array constructor. The function should take two arguments. The first is a pointer to the bytes that were originally passed to the Typed Array constructor. The second is a pointer to additional information desired at the time the bytes are to be freed."]
49pub type JSTypedArrayBytesDeallocator = ::std::option::Option<
50 unsafe extern "C" fn(
51 bytes: *mut ::std::os::raw::c_void,
52 deallocatorContext: *mut ::std::os::raw::c_void,
53 ),
54>;
55#[repr(C)]
56#[derive(Debug, Copy, Clone)]
57pub struct OpaqueJSValue {
58 _unused: [u8; 0],
59}
60#[doc = " @typedef JSValueRef A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them."]
61pub type JSValueRef = *const OpaqueJSValue;
62#[doc = " @typedef JSObjectRef A JavaScript object. A JSObject is a JSValue."]
63pub type JSObjectRef = *mut OpaqueJSValue;
64extern "C" {
65 #[doc = "@function JSEvaluateScript\n@abstract Evaluates a string of JavaScript.\n@param ctx The execution context to use.\n@param script A JSString containing the script to evaluate.\n@param thisObject The object to use as \"this,\" or NULL to use the global object as \"this.\"\n@param sourceURL A JSString containing a URL for the script's source file. This is used by debuggers and when reporting exceptions. Pass NULL if you do not care to include source file information.\n@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The JSValue that results from evaluating script, or NULL if an exception is thrown."]
66 pub fn JSEvaluateScript(
67 ctx: JSContextRef,
68 script: JSStringRef,
69 thisObject: JSObjectRef,
70 sourceURL: JSStringRef,
71 startingLineNumber: ::std::os::raw::c_int,
72 exception: *mut JSValueRef,
73 ) -> JSValueRef;
74}
75extern "C" {
76 #[doc = "@function JSCheckScriptSyntax\n@abstract Checks for syntax errors in a string of JavaScript.\n@param ctx The execution context to use.\n@param script A JSString containing the script to check for syntax errors.\n@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.\n@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1.\n@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.\n@result true if the script is syntactically correct, otherwise false."]
77 pub fn JSCheckScriptSyntax(
78 ctx: JSContextRef,
79 script: JSStringRef,
80 sourceURL: JSStringRef,
81 startingLineNumber: ::std::os::raw::c_int,
82 exception: *mut JSValueRef,
83 ) -> bool;
84}
85extern "C" {
86 #[doc = "@function JSGarbageCollect\n@abstract Performs a JavaScript garbage collection.\n@param ctx The execution context to use.\n@discussion JavaScript values that are on the machine stack, in a register,\nprotected by JSValueProtect, set as the global object of an execution context,\nor reachable from any such value will not be collected.\n\nDuring JavaScript execution, you are not required to call this function; the\nJavaScript engine will garbage collect as needed. JavaScript values created\nwithin a context group are automatically destroyed when the last reference\nto the context group is released."]
87 pub fn JSGarbageCollect(ctx: JSContextRef);
88}
89pub const JSType_kJSTypeUndefined: JSType = 0;
90pub const JSType_kJSTypeNull: JSType = 1;
91pub const JSType_kJSTypeBoolean: JSType = 2;
92pub const JSType_kJSTypeNumber: JSType = 3;
93pub const JSType_kJSTypeString: JSType = 4;
94pub const JSType_kJSTypeObject: JSType = 5;
95pub const JSType_kJSTypeSymbol: JSType = 6;
96#[doc = "@enum JSType\n@abstract A constant identifying the type of a JSValue.\n@constant kJSTypeUndefined The unique undefined value.\n@constant kJSTypeNull The unique null value.\n@constant kJSTypeBoolean A primitive boolean value, one of true or false.\n@constant kJSTypeNumber A primitive number value.\n@constant kJSTypeString A primitive string value.\n@constant kJSTypeObject An object value (meaning that this JSValueRef is a JSObjectRef).\n@constant kJSTypeSymbol A primitive symbol value."]
97pub type JSType = ::std::os::raw::c_uint;
98pub const JSTypedArrayType_kJSTypedArrayTypeInt8Array: JSTypedArrayType = 0;
99pub const JSTypedArrayType_kJSTypedArrayTypeInt16Array: JSTypedArrayType = 1;
100pub const JSTypedArrayType_kJSTypedArrayTypeInt32Array: JSTypedArrayType = 2;
101pub const JSTypedArrayType_kJSTypedArrayTypeUint8Array: JSTypedArrayType = 3;
102pub const JSTypedArrayType_kJSTypedArrayTypeUint8ClampedArray: JSTypedArrayType = 4;
103pub const JSTypedArrayType_kJSTypedArrayTypeUint16Array: JSTypedArrayType = 5;
104pub const JSTypedArrayType_kJSTypedArrayTypeUint32Array: JSTypedArrayType = 6;
105pub const JSTypedArrayType_kJSTypedArrayTypeFloat32Array: JSTypedArrayType = 7;
106pub const JSTypedArrayType_kJSTypedArrayTypeFloat64Array: JSTypedArrayType = 8;
107pub const JSTypedArrayType_kJSTypedArrayTypeArrayBuffer: JSTypedArrayType = 9;
108pub const JSTypedArrayType_kJSTypedArrayTypeNone: JSTypedArrayType = 10;
109pub const JSTypedArrayType_kJSTypedArrayTypeBigInt64Array: JSTypedArrayType = 11;
110pub const JSTypedArrayType_kJSTypedArrayTypeBigUint64Array: JSTypedArrayType = 12;
111#[doc = "@enum JSTypedArrayType\n@abstract A constant identifying the Typed Array type of a JSObjectRef.\n@constant kJSTypedArrayTypeInt8Array Int8Array\n@constant kJSTypedArrayTypeInt16Array Int16Array\n@constant kJSTypedArrayTypeInt32Array Int32Array\n@constant kJSTypedArrayTypeUint8Array Uint8Array\n@constant kJSTypedArrayTypeUint8ClampedArray Uint8ClampedArray\n@constant kJSTypedArrayTypeUint16Array Uint16Array\n@constant kJSTypedArrayTypeUint32Array Uint32Array\n@constant kJSTypedArrayTypeFloat32Array Float32Array\n@constant kJSTypedArrayTypeFloat64Array Float64Array\n@constant kJSTypedArrayTypeBigInt64Array BigInt64Array\n@constant kJSTypedArrayTypeBigUint64Array BigUint64Array\n@constant kJSTypedArrayTypeArrayBuffer ArrayBuffer\n@constant kJSTypedArrayTypeNone Not a Typed Array\n"]
112pub type JSTypedArrayType = ::std::os::raw::c_uint;
113extern "C" {
114 #[doc = "@function\n@abstract Returns a JavaScript value's type.\n@param ctx The execution context to use.\n@param value The JSValue whose type you want to obtain.\n@result A value of type JSType that identifies value's type."]
115 pub fn JSValueGetType(ctx: JSContextRef, value: JSValueRef) -> JSType;
116}
117extern "C" {
118 #[doc = "@function\n@abstract Tests whether a JavaScript value's type is the undefined type.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@result true if value's type is the undefined type, otherwise false."]
119 pub fn JSValueIsUndefined(ctx: JSContextRef, value: JSValueRef) -> bool;
120}
121extern "C" {
122 #[doc = "@function\n@abstract Tests whether a JavaScript value's type is the null type.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@result true if value's type is the null type, otherwise false."]
123 pub fn JSValueIsNull(ctx: JSContextRef, value: JSValueRef) -> bool;
124}
125extern "C" {
126 #[doc = "@function\n@abstract Tests whether a JavaScript value's type is the boolean type.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@result true if value's type is the boolean type, otherwise false."]
127 pub fn JSValueIsBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
128}
129extern "C" {
130 #[doc = "@function\n@abstract Tests whether a JavaScript value's type is the number type.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@result true if value's type is the number type, otherwise false."]
131 pub fn JSValueIsNumber(ctx: JSContextRef, value: JSValueRef) -> bool;
132}
133extern "C" {
134 #[doc = "@function\n@abstract Tests whether a JavaScript value's type is the string type.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@result true if value's type is the string type, otherwise false."]
135 pub fn JSValueIsString(ctx: JSContextRef, value: JSValueRef) -> bool;
136}
137extern "C" {
138 #[doc = "@function\n@abstract Tests whether a JavaScript value's type is the symbol type.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@result true if value's type is the symbol type, otherwise false."]
139 pub fn JSValueIsSymbol(ctx: JSContextRef, value: JSValueRef) -> bool;
140}
141extern "C" {
142 #[doc = "@function\n@abstract Tests whether a JavaScript value's type is the object type.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@result true if value's type is the object type, otherwise false."]
143 pub fn JSValueIsObject(ctx: JSContextRef, value: JSValueRef) -> bool;
144}
145extern "C" {
146 #[doc = "@function\n@abstract Tests whether a JavaScript value is an object with a given class in its class chain.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@param jsClass The JSClass to test against.\n@result true if value is an object and has jsClass in its class chain, otherwise false."]
147 pub fn JSValueIsObjectOfClass(
148 ctx: JSContextRef,
149 value: JSValueRef,
150 jsClass: JSClassRef,
151 ) -> bool;
152}
153extern "C" {
154 #[doc = "@function\n@abstract Tests whether a JavaScript value is an array.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@result true if value is an array, otherwise false."]
155 pub fn JSValueIsArray(ctx: JSContextRef, value: JSValueRef) -> bool;
156}
157extern "C" {
158 #[doc = "@function\n@abstract Tests whether a JavaScript value is a date.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@result true if value is a date, otherwise false."]
159 pub fn JSValueIsDate(ctx: JSContextRef, value: JSValueRef) -> bool;
160}
161extern "C" {
162 #[doc = "@function\n@abstract Returns a JavaScript value's Typed Array type.\n@param ctx The execution context to use.\n@param value The JSValue whose Typed Array type to return.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A value of type JSTypedArrayType that identifies value's Typed Array type, or kJSTypedArrayTypeNone if the value is not a Typed Array object."]
163 pub fn JSValueGetTypedArrayType(
164 ctx: JSContextRef,
165 value: JSValueRef,
166 exception: *mut JSValueRef,
167 ) -> JSTypedArrayType;
168}
169extern "C" {
170 #[doc = "@function\n@abstract Tests whether two JavaScript values are equal, as compared by the JS == operator.\n@param ctx The execution context to use.\n@param a The first value to test.\n@param b The second value to test.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result true if the two values are equal, false if they are not equal or an exception is thrown."]
171 pub fn JSValueIsEqual(
172 ctx: JSContextRef,
173 a: JSValueRef,
174 b: JSValueRef,
175 exception: *mut JSValueRef,
176 ) -> bool;
177}
178extern "C" {
179 #[doc = "@function\n@abstract Tests whether two JavaScript values are strict equal, as compared by the JS === operator.\n@param ctx The execution context to use.\n@param a The first value to test.\n@param b The second value to test.\n@result true if the two values are strict equal, otherwise false."]
180 pub fn JSValueIsStrictEqual(ctx: JSContextRef, a: JSValueRef, b: JSValueRef) -> bool;
181}
182extern "C" {
183 #[doc = "@function\n@abstract Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.\n@param ctx The execution context to use.\n@param value The JSValue to test.\n@param constructor The constructor to test against.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false."]
184 pub fn JSValueIsInstanceOfConstructor(
185 ctx: JSContextRef,
186 value: JSValueRef,
187 constructor: JSObjectRef,
188 exception: *mut JSValueRef,
189 ) -> bool;
190}
191extern "C" {
192 #[doc = "@function\n@abstract Creates a JavaScript value of the undefined type.\n@param ctx The execution context to use.\n@result The unique undefined value."]
193 pub fn JSValueMakeUndefined(ctx: JSContextRef) -> JSValueRef;
194}
195extern "C" {
196 #[doc = "@function\n@abstract Creates a JavaScript value of the null type.\n@param ctx The execution context to use.\n@result The unique null value."]
197 pub fn JSValueMakeNull(ctx: JSContextRef) -> JSValueRef;
198}
199extern "C" {
200 #[doc = "@function\n@abstract Creates a JavaScript value of the boolean type.\n@param ctx The execution context to use.\n@param boolean The bool to assign to the newly created JSValue.\n@result A JSValue of the boolean type, representing the value of boolean."]
201 pub fn JSValueMakeBoolean(ctx: JSContextRef, boolean: bool) -> JSValueRef;
202}
203extern "C" {
204 #[doc = "@function\n@abstract Creates a JavaScript value of the number type.\n@param ctx The execution context to use.\n@param number The double to assign to the newly created JSValue.\n@result A JSValue of the number type, representing the value of number."]
205 pub fn JSValueMakeNumber(ctx: JSContextRef, number: f64) -> JSValueRef;
206}
207extern "C" {
208 #[doc = "@function\n@abstract Creates a JavaScript value of the string type.\n@param ctx The execution context to use.\n@param string The JSString to assign to the newly created JSValue. The\nnewly created JSValue retains string, and releases it upon garbage collection.\n@result A JSValue of the string type, representing the value of string."]
209 pub fn JSValueMakeString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
210}
211extern "C" {
212 #[doc = "@function\n@abstract Creates a JavaScript value of the symbol type.\n@param ctx The execution context to use.\n@param description A description of the newly created symbol value.\n@result A unique JSValue of the symbol type, whose description matches the one provided."]
213 pub fn JSValueMakeSymbol(ctx: JSContextRef, description: JSStringRef) -> JSValueRef;
214}
215extern "C" {
216 #[doc = "@function\n@abstract Creates a JavaScript value from a JSON formatted string.\n@param ctx The execution context to use.\n@param string The JSString containing the JSON string to be parsed.\n@result A JSValue containing the parsed value, or NULL if the input is invalid."]
217 pub fn JSValueMakeFromJSONString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
218}
219extern "C" {
220 #[doc = "@function\n@abstract Creates a JavaScript string containing the JSON serialized representation of a JS value.\n@param ctx The execution context to use.\n@param value The value to serialize.\n@param indent The number of spaces to indent when nesting. If 0, the resulting JSON will not contains newlines. The size of the indent is clamped to 10 spaces.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSString with the result of serialization, or NULL if an exception is thrown."]
221 pub fn JSValueCreateJSONString(
222 ctx: JSContextRef,
223 value: JSValueRef,
224 indent: ::std::os::raw::c_uint,
225 exception: *mut JSValueRef,
226 ) -> JSStringRef;
227}
228extern "C" {
229 #[doc = "@function\n@abstract Converts a JavaScript value to boolean and returns the resulting boolean.\n@param ctx The execution context to use.\n@param value The JSValue to convert.\n@result The boolean result of conversion."]
230 pub fn JSValueToBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
231}
232extern "C" {
233 #[doc = "@function\n@abstract Converts a JavaScript value to number and returns the resulting number.\n@param ctx The execution context to use.\n@param value The JSValue to convert.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The numeric result of conversion, or NaN if an exception is thrown."]
234 pub fn JSValueToNumber(ctx: JSContextRef, value: JSValueRef, exception: *mut JSValueRef)
235 -> f64;
236}
237extern "C" {
238 #[doc = "@function\n@abstract Converts a JavaScript value to string and copies the result into a JavaScript string.\n@param ctx The execution context to use.\n@param value The JSValue to convert.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule."]
239 pub fn JSValueToStringCopy(
240 ctx: JSContextRef,
241 value: JSValueRef,
242 exception: *mut JSValueRef,
243 ) -> JSStringRef;
244}
245extern "C" {
246 #[doc = "@function\n@abstract Converts a JavaScript value to object and returns the resulting object.\n@param ctx The execution context to use.\n@param value The JSValue to convert.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The JSObject result of conversion, or NULL if an exception is thrown."]
247 pub fn JSValueToObject(
248 ctx: JSContextRef,
249 value: JSValueRef,
250 exception: *mut JSValueRef,
251 ) -> JSObjectRef;
252}
253extern "C" {
254 #[doc = "@function\n@abstract Protects a JavaScript value from garbage collection.\n@param ctx The execution context to use.\n@param value The JSValue to protect.\n@discussion Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it.\n\nA value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection."]
255 pub fn JSValueProtect(ctx: JSContextRef, value: JSValueRef);
256}
257extern "C" {
258 #[doc = "@function\n@abstract Unprotects a JavaScript value from garbage collection.\n@param ctx The execution context to use.\n@param value The JSValue to unprotect.\n@discussion A value may be protected multiple times and must be unprotected an\nequal number of times before becoming eligible for garbage collection."]
259 pub fn JSValueUnprotect(ctx: JSContextRef, value: JSValueRef);
260}
261#[doc = "@typedef JSPropertyAttributes\n@abstract A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together."]
262pub type JSPropertyAttributes = ::std::os::raw::c_uint;
263#[doc = "@typedef JSClassAttributes\n@abstract A set of JSClassAttributes. Combine multiple attributes by logically ORing them together."]
264pub type JSClassAttributes = ::std::os::raw::c_uint;
265#[doc = "@typedef JSObjectInitializeCallback\n@abstract The callback invoked when an object is first created.\n@param ctx The execution context to use.\n@param object The JSObject being created.\n@discussion If you named your function Initialize, you would declare it like this:\n\nvoid Initialize(JSContextRef ctx, JSObjectRef object);\n\nUnlike the other object callbacks, the initialize callback is called on the least\nderived class (the parent class) first, and the most derived class last."]
266pub type JSObjectInitializeCallback =
267 ::std::option::Option<unsafe extern "C" fn(ctx: JSContextRef, object: JSObjectRef)>;
268#[doc = "@typedef JSObjectFinalizeCallback\n@abstract The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.\n@param object The JSObject being finalized.\n@discussion If you named your function Finalize, you would declare it like this:\n\nvoid Finalize(JSObjectRef object);\n\nThe finalize callback is called on the most derived class first, and the least\nderived class (the parent class) last.\n\nYou must not call any function that may cause a garbage collection or an allocation\nof a garbage collected object from within a JSObjectFinalizeCallback. This includes\nall functions that have a JSContextRef parameter."]
269pub type JSObjectFinalizeCallback =
270 ::std::option::Option<unsafe extern "C" fn(object: JSObjectRef)>;
271#[doc = "@typedef JSObjectHasPropertyCallback\n@abstract The callback invoked when determining whether an object has a property.\n@param ctx The execution context to use.\n@param object The JSObject to search for the property.\n@param propertyName A JSString containing the name of the property look up.\n@result true if object has the property, otherwise false.\n@discussion If you named your function HasProperty, you would declare it like this:\n\nbool HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName);\n\nIf this function returns false, the hasProperty request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain.\n\nThis callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value would be expensive.\n\nIf this callback is NULL, the getProperty callback will be used to service hasProperty requests."]
272pub type JSObjectHasPropertyCallback = ::std::option::Option<
273 unsafe extern "C" fn(ctx: JSContextRef, object: JSObjectRef, propertyName: JSStringRef) -> bool,
274>;
275#[doc = "@typedef JSObjectGetPropertyCallback\n@abstract The callback invoked when getting a property's value.\n@param ctx The execution context to use.\n@param object The JSObject to search for the property.\n@param propertyName A JSString containing the name of the property to get.\n@param exception A pointer to a JSValueRef in which to return an exception, if any.\n@result The property's value if object has the property, otherwise NULL.\n@discussion If you named your function GetProperty, you would declare it like this:\n\nJSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);\n\nIf this function returns NULL, the get request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain."]
276pub type JSObjectGetPropertyCallback = ::std::option::Option<
277 unsafe extern "C" fn(
278 ctx: JSContextRef,
279 object: JSObjectRef,
280 propertyName: JSStringRef,
281 exception: *mut JSValueRef,
282 ) -> JSValueRef,
283>;
284#[doc = "@typedef JSObjectSetPropertyCallback\n@abstract The callback invoked when setting a property's value.\n@param ctx The execution context to use.\n@param object The JSObject on which to set the property's value.\n@param propertyName A JSString containing the name of the property to set.\n@param value A JSValue to use as the property's value.\n@param exception A pointer to a JSValueRef in which to return an exception, if any.\n@result true if the property was set, otherwise false.\n@discussion If you named your function SetProperty, you would declare it like this:\n\nbool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);\n\nIf this function returns false, the set request forwards to object's statically declared properties, then its parent class chain (which includes the default object class)."]
285pub type JSObjectSetPropertyCallback = ::std::option::Option<
286 unsafe extern "C" fn(
287 ctx: JSContextRef,
288 object: JSObjectRef,
289 propertyName: JSStringRef,
290 value: JSValueRef,
291 exception: *mut JSValueRef,
292 ) -> bool,
293>;
294#[doc = "@typedef JSObjectDeletePropertyCallback\n@abstract The callback invoked when deleting a property.\n@param ctx The execution context to use.\n@param object The JSObject in which to delete the property.\n@param propertyName A JSString containing the name of the property to delete.\n@param exception A pointer to a JSValueRef in which to return an exception, if any.\n@result true if propertyName was successfully deleted, otherwise false.\n@discussion If you named your function DeleteProperty, you would declare it like this:\n\nbool DeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);\n\nIf this function returns false, the delete request forwards to object's statically declared properties, then its parent class chain (which includes the default object class)."]
295pub type JSObjectDeletePropertyCallback = ::std::option::Option<
296 unsafe extern "C" fn(
297 ctx: JSContextRef,
298 object: JSObjectRef,
299 propertyName: JSStringRef,
300 exception: *mut JSValueRef,
301 ) -> bool,
302>;
303#[doc = "@typedef JSObjectGetPropertyNamesCallback\n@abstract The callback invoked when collecting the names of an object's properties.\n@param ctx The execution context to use.\n@param object The JSObject whose property names are being collected.\n@param propertyNames A JavaScript property name accumulator in which to accumulate the names of object's properties.\n@discussion If you named your function GetPropertyNames, you would declare it like this:\n\nvoid GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames);\n\nProperty name accumulators are used by JSObjectCopyPropertyNames and JavaScript for...in loops.\n\nUse JSPropertyNameAccumulatorAddName to add property names to accumulator. A class's getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object's prototype, are added independently."]
304pub type JSObjectGetPropertyNamesCallback = ::std::option::Option<
305 unsafe extern "C" fn(
306 ctx: JSContextRef,
307 object: JSObjectRef,
308 propertyNames: JSPropertyNameAccumulatorRef,
309 ),
310>;
311#[doc = "@typedef JSObjectCallAsFunctionCallback\n@abstract The callback invoked when an object is called as a function.\n@param ctx The execution context to use.\n@param function A JSObject that is the function being called.\n@param thisObject A JSObject that is the 'this' variable in the function's scope.\n@param argumentCount An integer count of the number of arguments in arguments.\n@param arguments A JSValue array of the arguments passed to the function.\n@param exception A pointer to a JSValueRef in which to return an exception, if any.\n@result A JSValue that is the function's return value.\n@discussion If you named your function CallAsFunction, you would declare it like this:\n\nJSValueRef CallAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);\n\nIf your callback were invoked by the JavaScript expression 'myObject.myFunction()', function would be set to myFunction, and thisObject would be set to myObject.\n\nIf this callback is NULL, calling your object as a function will throw an exception."]
312pub type JSObjectCallAsFunctionCallback = ::std::option::Option<
313 unsafe extern "C" fn(
314 ctx: JSContextRef,
315 function: JSObjectRef,
316 thisObject: JSObjectRef,
317 argumentCount: usize,
318 arguments: *const JSValueRef,
319 exception: *mut JSValueRef,
320 ) -> JSValueRef,
321>;
322#[doc = "@typedef JSObjectCallAsConstructorCallback\n@abstract The callback invoked when an object is used as a constructor in a 'new' expression.\n@param ctx The execution context to use.\n@param constructor A JSObject that is the constructor being called.\n@param argumentCount An integer count of the number of arguments in arguments.\n@param arguments A JSValue array of the arguments passed to the function.\n@param exception A pointer to a JSValueRef in which to return an exception, if any.\n@result A JSObject that is the constructor's return value.\n@discussion If you named your function CallAsConstructor, you would declare it like this:\n\nJSObjectRef CallAsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);\n\nIf your callback were invoked by the JavaScript expression 'new myConstructor()', constructor would be set to myConstructor.\n\nIf this callback is NULL, using your object as a constructor in a 'new' expression will throw an exception."]
323pub type JSObjectCallAsConstructorCallback = ::std::option::Option<
324 unsafe extern "C" fn(
325 ctx: JSContextRef,
326 constructor: JSObjectRef,
327 argumentCount: usize,
328 arguments: *const JSValueRef,
329 exception: *mut JSValueRef,
330 ) -> JSObjectRef,
331>;
332#[doc = "@typedef JSObjectHasInstanceCallback\n@abstract hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression.\n@param ctx The execution context to use.\n@param constructor The JSObject that is the target of the 'instanceof' expression.\n@param possibleInstance The JSValue being tested to determine if it is an instance of constructor.\n@param exception A pointer to a JSValueRef in which to return an exception, if any.\n@result true if possibleInstance is an instance of constructor, otherwise false.\n@discussion If you named your function HasInstance, you would declare it like this:\n\nbool HasInstance(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);\n\nIf your callback were invoked by the JavaScript expression 'someValue instanceof myObject', constructor would be set to myObject and possibleInstance would be set to someValue.\n\nIf this callback is NULL, 'instanceof' expressions that target your object will return false.\n\nStandard JavaScript practice calls for objects that implement the callAsConstructor callback to implement the hasInstance callback as well."]
333pub type JSObjectHasInstanceCallback = ::std::option::Option<
334 unsafe extern "C" fn(
335 ctx: JSContextRef,
336 constructor: JSObjectRef,
337 possibleInstance: JSValueRef,
338 exception: *mut JSValueRef,
339 ) -> bool,
340>;
341#[doc = "@typedef JSObjectConvertToTypeCallback\n@abstract The callback invoked when converting an object to a particular JavaScript type.\n@param ctx The execution context to use.\n@param object The JSObject to convert.\n@param type A JSType specifying the JavaScript type to convert to.\n@param exception A pointer to a JSValueRef in which to return an exception, if any.\n@result The objects's converted value, or NULL if the object was not converted.\n@discussion If you named your function ConvertToType, you would declare it like this:\n\nJSValueRef ConvertToType(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception);\n\nIf this function returns false, the conversion request forwards to object's parent class chain (which includes the default object class).\n\nThis function is only invoked when converting an object to number or string. An object converted to boolean is 'true.' An object converted to object is itself."]
342pub type JSObjectConvertToTypeCallback = ::std::option::Option<
343 unsafe extern "C" fn(
344 ctx: JSContextRef,
345 object: JSObjectRef,
346 type_: JSType,
347 exception: *mut JSValueRef,
348 ) -> JSValueRef,
349>;
350#[doc = "@struct JSStaticValue\n@abstract This structure describes a statically declared value property.\n@field name A null-terminated UTF8 string containing the property's name.\n@field getProperty A JSObjectGetPropertyCallback to invoke when getting the property's value.\n@field setProperty A JSObjectSetPropertyCallback to invoke when setting the property's value. May be NULL if the ReadOnly attribute is set.\n@field attributes A logically ORed set of JSPropertyAttributes to give to the property."]
351#[repr(C)]
352#[derive(Debug, Copy, Clone)]
353pub struct JSStaticValue {
354 pub name: *const ::std::os::raw::c_char,
355 pub getProperty: JSObjectGetPropertyCallback,
356 pub setProperty: JSObjectSetPropertyCallback,
357 pub attributes: JSPropertyAttributes,
358}
359#[test]
360fn bindgen_test_layout_JSStaticValue() {
361 const UNINIT: ::std::mem::MaybeUninit<JSStaticValue> = ::std::mem::MaybeUninit::uninit();
362 let ptr = UNINIT.as_ptr();
363 assert_eq!(
364 ::std::mem::size_of::<JSStaticValue>(),
365 32usize,
366 concat!("Size of: ", stringify!(JSStaticValue))
367 );
368 assert_eq!(
369 ::std::mem::align_of::<JSStaticValue>(),
370 8usize,
371 concat!("Alignment of ", stringify!(JSStaticValue))
372 );
373 assert_eq!(
374 unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
375 0usize,
376 concat!(
377 "Offset of field: ",
378 stringify!(JSStaticValue),
379 "::",
380 stringify!(name)
381 )
382 );
383 assert_eq!(
384 unsafe { ::std::ptr::addr_of!((*ptr).getProperty) as usize - ptr as usize },
385 8usize,
386 concat!(
387 "Offset of field: ",
388 stringify!(JSStaticValue),
389 "::",
390 stringify!(getProperty)
391 )
392 );
393 assert_eq!(
394 unsafe { ::std::ptr::addr_of!((*ptr).setProperty) as usize - ptr as usize },
395 16usize,
396 concat!(
397 "Offset of field: ",
398 stringify!(JSStaticValue),
399 "::",
400 stringify!(setProperty)
401 )
402 );
403 assert_eq!(
404 unsafe { ::std::ptr::addr_of!((*ptr).attributes) as usize - ptr as usize },
405 24usize,
406 concat!(
407 "Offset of field: ",
408 stringify!(JSStaticValue),
409 "::",
410 stringify!(attributes)
411 )
412 );
413}
414impl Default for JSStaticValue {
415 fn default() -> Self {
416 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
417 unsafe {
418 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
419 s.assume_init()
420 }
421 }
422}
423#[doc = "@struct JSStaticFunction\n@abstract This structure describes a statically declared function property.\n@field name A null-terminated UTF8 string containing the property's name.\n@field callAsFunction A JSObjectCallAsFunctionCallback to invoke when the property is called as a function.\n@field attributes A logically ORed set of JSPropertyAttributes to give to the property."]
424#[repr(C)]
425#[derive(Debug, Copy, Clone)]
426pub struct JSStaticFunction {
427 pub name: *const ::std::os::raw::c_char,
428 pub callAsFunction: JSObjectCallAsFunctionCallback,
429 pub attributes: JSPropertyAttributes,
430}
431#[test]
432fn bindgen_test_layout_JSStaticFunction() {
433 const UNINIT: ::std::mem::MaybeUninit<JSStaticFunction> = ::std::mem::MaybeUninit::uninit();
434 let ptr = UNINIT.as_ptr();
435 assert_eq!(
436 ::std::mem::size_of::<JSStaticFunction>(),
437 24usize,
438 concat!("Size of: ", stringify!(JSStaticFunction))
439 );
440 assert_eq!(
441 ::std::mem::align_of::<JSStaticFunction>(),
442 8usize,
443 concat!("Alignment of ", stringify!(JSStaticFunction))
444 );
445 assert_eq!(
446 unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
447 0usize,
448 concat!(
449 "Offset of field: ",
450 stringify!(JSStaticFunction),
451 "::",
452 stringify!(name)
453 )
454 );
455 assert_eq!(
456 unsafe { ::std::ptr::addr_of!((*ptr).callAsFunction) as usize - ptr as usize },
457 8usize,
458 concat!(
459 "Offset of field: ",
460 stringify!(JSStaticFunction),
461 "::",
462 stringify!(callAsFunction)
463 )
464 );
465 assert_eq!(
466 unsafe { ::std::ptr::addr_of!((*ptr).attributes) as usize - ptr as usize },
467 16usize,
468 concat!(
469 "Offset of field: ",
470 stringify!(JSStaticFunction),
471 "::",
472 stringify!(attributes)
473 )
474 );
475}
476impl Default for JSStaticFunction {
477 fn default() -> Self {
478 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
479 unsafe {
480 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
481 s.assume_init()
482 }
483 }
484}
485#[doc = "@struct JSClassDefinition\n@abstract This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL.\n@field version The version number of this structure. The current version is 0.\n@field attributes A logically ORed set of JSClassAttributes to give to the class.\n@field className A null-terminated UTF8 string containing the class's name.\n@field parentClass A JSClass to set as the class's parent class. Pass NULL use the default object class.\n@field staticValues A JSStaticValue array containing the class's statically declared value properties. Pass NULL to specify no statically declared value properties. The array must be terminated by a JSStaticValue whose name field is NULL.\n@field staticFunctions A JSStaticFunction array containing the class's statically declared function properties. Pass NULL to specify no statically declared function properties. The array must be terminated by a JSStaticFunction whose name field is NULL.\n@field initialize The callback invoked when an object is first created. Use this callback to initialize the object.\n@field finalize The callback invoked when an object is finalized (prepared for garbage collection). Use this callback to release resources allocated for the object, and perform other cleanup.\n@field hasProperty The callback invoked when determining whether an object has a property. If this field is NULL, getProperty is called instead. The hasProperty callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value is expensive.\n@field getProperty The callback invoked when getting a property's value.\n@field setProperty The callback invoked when setting a property's value.\n@field deleteProperty The callback invoked when deleting a property.\n@field getPropertyNames The callback invoked when collecting the names of an object's properties.\n@field callAsFunction The callback invoked when an object is called as a function.\n@field hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression.\n@field callAsConstructor The callback invoked when an object is used as a constructor in a 'new' expression.\n@field convertToType The callback invoked when converting an object to a particular JavaScript type.\n@discussion The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time.\n\nIf you named your getter function \"GetX\" and your setter function \"SetX\", you would declare a JSStaticValue array containing \"X\" like this:\n\nJSStaticValue StaticValueArray[] = {\n{ \"X\", GetX, SetX, kJSPropertyAttributeNone },\n{ 0, 0, 0, 0 }\n};\n\nStandard JavaScript practice calls for storing function objects in prototypes, so they can be shared. The default JSClass created by JSClassCreate follows this idiom, instantiating objects with a shared, automatically generating prototype containing the class's function objects. The kJSClassAttributeNoAutomaticPrototype attribute specifies that a JSClass should not automatically generate such a prototype. The resulting JSClass instantiates objects with the default object prototype, and gives each instance object its own copy of the class's function objects.\n\nA NULL callback specifies that the default object callback should substitute, except in the case of hasProperty, where it specifies that getProperty should substitute.\n\nIt is not possible to use JS subclassing with objects created from a class definition that sets callAsConstructor by default. Subclassing is supported via the JSObjectMakeConstructor function, however."]
486#[repr(C)]
487#[derive(Debug, Copy, Clone)]
488pub struct JSClassDefinition {
489 pub version: ::std::os::raw::c_int,
490 pub attributes: JSClassAttributes,
491 pub className: *const ::std::os::raw::c_char,
492 pub parentClass: JSClassRef,
493 pub staticValues: *const JSStaticValue,
494 pub staticFunctions: *const JSStaticFunction,
495 pub initialize: JSObjectInitializeCallback,
496 pub finalize: JSObjectFinalizeCallback,
497 pub hasProperty: JSObjectHasPropertyCallback,
498 pub getProperty: JSObjectGetPropertyCallback,
499 pub setProperty: JSObjectSetPropertyCallback,
500 pub deleteProperty: JSObjectDeletePropertyCallback,
501 pub getPropertyNames: JSObjectGetPropertyNamesCallback,
502 pub callAsFunction: JSObjectCallAsFunctionCallback,
503 pub callAsConstructor: JSObjectCallAsConstructorCallback,
504 pub hasInstance: JSObjectHasInstanceCallback,
505 pub convertToType: JSObjectConvertToTypeCallback,
506}
507#[test]
508fn bindgen_test_layout_JSClassDefinition() {
509 const UNINIT: ::std::mem::MaybeUninit<JSClassDefinition> = ::std::mem::MaybeUninit::uninit();
510 let ptr = UNINIT.as_ptr();
511 assert_eq!(
512 ::std::mem::size_of::<JSClassDefinition>(),
513 128usize,
514 concat!("Size of: ", stringify!(JSClassDefinition))
515 );
516 assert_eq!(
517 ::std::mem::align_of::<JSClassDefinition>(),
518 8usize,
519 concat!("Alignment of ", stringify!(JSClassDefinition))
520 );
521 assert_eq!(
522 unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize },
523 0usize,
524 concat!(
525 "Offset of field: ",
526 stringify!(JSClassDefinition),
527 "::",
528 stringify!(version)
529 )
530 );
531 assert_eq!(
532 unsafe { ::std::ptr::addr_of!((*ptr).attributes) as usize - ptr as usize },
533 4usize,
534 concat!(
535 "Offset of field: ",
536 stringify!(JSClassDefinition),
537 "::",
538 stringify!(attributes)
539 )
540 );
541 assert_eq!(
542 unsafe { ::std::ptr::addr_of!((*ptr).className) as usize - ptr as usize },
543 8usize,
544 concat!(
545 "Offset of field: ",
546 stringify!(JSClassDefinition),
547 "::",
548 stringify!(className)
549 )
550 );
551 assert_eq!(
552 unsafe { ::std::ptr::addr_of!((*ptr).parentClass) as usize - ptr as usize },
553 16usize,
554 concat!(
555 "Offset of field: ",
556 stringify!(JSClassDefinition),
557 "::",
558 stringify!(parentClass)
559 )
560 );
561 assert_eq!(
562 unsafe { ::std::ptr::addr_of!((*ptr).staticValues) as usize - ptr as usize },
563 24usize,
564 concat!(
565 "Offset of field: ",
566 stringify!(JSClassDefinition),
567 "::",
568 stringify!(staticValues)
569 )
570 );
571 assert_eq!(
572 unsafe { ::std::ptr::addr_of!((*ptr).staticFunctions) as usize - ptr as usize },
573 32usize,
574 concat!(
575 "Offset of field: ",
576 stringify!(JSClassDefinition),
577 "::",
578 stringify!(staticFunctions)
579 )
580 );
581 assert_eq!(
582 unsafe { ::std::ptr::addr_of!((*ptr).initialize) as usize - ptr as usize },
583 40usize,
584 concat!(
585 "Offset of field: ",
586 stringify!(JSClassDefinition),
587 "::",
588 stringify!(initialize)
589 )
590 );
591 assert_eq!(
592 unsafe { ::std::ptr::addr_of!((*ptr).finalize) as usize - ptr as usize },
593 48usize,
594 concat!(
595 "Offset of field: ",
596 stringify!(JSClassDefinition),
597 "::",
598 stringify!(finalize)
599 )
600 );
601 assert_eq!(
602 unsafe { ::std::ptr::addr_of!((*ptr).hasProperty) as usize - ptr as usize },
603 56usize,
604 concat!(
605 "Offset of field: ",
606 stringify!(JSClassDefinition),
607 "::",
608 stringify!(hasProperty)
609 )
610 );
611 assert_eq!(
612 unsafe { ::std::ptr::addr_of!((*ptr).getProperty) as usize - ptr as usize },
613 64usize,
614 concat!(
615 "Offset of field: ",
616 stringify!(JSClassDefinition),
617 "::",
618 stringify!(getProperty)
619 )
620 );
621 assert_eq!(
622 unsafe { ::std::ptr::addr_of!((*ptr).setProperty) as usize - ptr as usize },
623 72usize,
624 concat!(
625 "Offset of field: ",
626 stringify!(JSClassDefinition),
627 "::",
628 stringify!(setProperty)
629 )
630 );
631 assert_eq!(
632 unsafe { ::std::ptr::addr_of!((*ptr).deleteProperty) as usize - ptr as usize },
633 80usize,
634 concat!(
635 "Offset of field: ",
636 stringify!(JSClassDefinition),
637 "::",
638 stringify!(deleteProperty)
639 )
640 );
641 assert_eq!(
642 unsafe { ::std::ptr::addr_of!((*ptr).getPropertyNames) as usize - ptr as usize },
643 88usize,
644 concat!(
645 "Offset of field: ",
646 stringify!(JSClassDefinition),
647 "::",
648 stringify!(getPropertyNames)
649 )
650 );
651 assert_eq!(
652 unsafe { ::std::ptr::addr_of!((*ptr).callAsFunction) as usize - ptr as usize },
653 96usize,
654 concat!(
655 "Offset of field: ",
656 stringify!(JSClassDefinition),
657 "::",
658 stringify!(callAsFunction)
659 )
660 );
661 assert_eq!(
662 unsafe { ::std::ptr::addr_of!((*ptr).callAsConstructor) as usize - ptr as usize },
663 104usize,
664 concat!(
665 "Offset of field: ",
666 stringify!(JSClassDefinition),
667 "::",
668 stringify!(callAsConstructor)
669 )
670 );
671 assert_eq!(
672 unsafe { ::std::ptr::addr_of!((*ptr).hasInstance) as usize - ptr as usize },
673 112usize,
674 concat!(
675 "Offset of field: ",
676 stringify!(JSClassDefinition),
677 "::",
678 stringify!(hasInstance)
679 )
680 );
681 assert_eq!(
682 unsafe { ::std::ptr::addr_of!((*ptr).convertToType) as usize - ptr as usize },
683 120usize,
684 concat!(
685 "Offset of field: ",
686 stringify!(JSClassDefinition),
687 "::",
688 stringify!(convertToType)
689 )
690 );
691}
692impl Default for JSClassDefinition {
693 fn default() -> Self {
694 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
695 unsafe {
696 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
697 s.assume_init()
698 }
699 }
700}
701extern "C" {
702 #[doc = "@function\n@abstract Creates a JavaScript class suitable for use with JSObjectMake.\n@param definition A JSClassDefinition that defines the class.\n@result A JSClass with the given definition. Ownership follows the Create Rule."]
703 pub fn JSClassCreate(definition: *const JSClassDefinition) -> JSClassRef;
704}
705extern "C" {
706 #[doc = "@function\n@abstract Retains a JavaScript class.\n@param jsClass The JSClass to retain.\n@result A JSClass that is the same as jsClass."]
707 pub fn JSClassRetain(jsClass: JSClassRef) -> JSClassRef;
708}
709extern "C" {
710 #[doc = "@function\n@abstract Releases a JavaScript class.\n@param jsClass The JSClass to release."]
711 pub fn JSClassRelease(jsClass: JSClassRef);
712}
713extern "C" {
714 #[doc = "@function\n@abstract Creates a JavaScript object.\n@param ctx The execution context to use.\n@param jsClass The JSClass to assign to the object. Pass NULL to use the default object class.\n@param data A void* to set as the object's private data. Pass NULL to specify no private data.\n@result A JSObject with the given class and private data.\n@discussion The default object class does not allocate storage for private data, so you must provide a non-NULL jsClass to JSObjectMake if you want your object to be able to store private data.\n\ndata is set on the created object before the intialize methods in its class chain are called. This enables the initialize methods to retrieve and manipulate data through JSObjectGetPrivate."]
715 pub fn JSObjectMake(
716 ctx: JSContextRef,
717 jsClass: JSClassRef,
718 data: *mut ::std::os::raw::c_void,
719 ) -> JSObjectRef;
720}
721extern "C" {
722 #[doc = "@function\n@abstract Convenience method for creating a JavaScript function with a given callback as its implementation.\n@param ctx The execution context to use.\n@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function.\n@param callAsFunction The JSObjectCallAsFunctionCallback to invoke when the function is called.\n@result A JSObject that is a function. The object's prototype will be the default function prototype."]
723 pub fn JSObjectMakeFunctionWithCallback(
724 ctx: JSContextRef,
725 name: JSStringRef,
726 callAsFunction: JSObjectCallAsFunctionCallback,
727 ) -> JSObjectRef;
728}
729extern "C" {
730 #[doc = "@function\n@abstract Convenience method for creating a JavaScript constructor.\n@param ctx The execution context to use.\n@param jsClass A JSClass that is the class your constructor will assign to the objects its constructs. jsClass will be used to set the constructor's .prototype property, and to evaluate 'instanceof' expressions. Pass NULL to use the default object class.\n@param callAsConstructor A JSObjectCallAsConstructorCallback to invoke when your constructor is used in a 'new' expression. Pass NULL to use the default object constructor.\n@result A JSObject that is a constructor. The object's prototype will be the default object prototype.\n@discussion The default object constructor takes no arguments and constructs an object of class jsClass with no private data. If the constructor is inherited via JS subclassing and the value returned from callAsConstructor was created with jsClass, then the returned object will have it's prototype overridden to the derived class's prototype."]
731 pub fn JSObjectMakeConstructor(
732 ctx: JSContextRef,
733 jsClass: JSClassRef,
734 callAsConstructor: JSObjectCallAsConstructorCallback,
735 ) -> JSObjectRef;
736}
737extern "C" {
738 #[doc = "@function\n@abstract Creates a JavaScript Array object.\n@param ctx The execution context to use.\n@param argumentCount An integer count of the number of arguments in arguments.\n@param arguments A JSValue array of data to populate the Array with. Pass NULL if argumentCount is 0.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObject that is an Array.\n@discussion The behavior of this function does not exactly match the behavior of the built-in Array constructor. Specifically, if one argument\nis supplied, this function returns an array with one element."]
739 pub fn JSObjectMakeArray(
740 ctx: JSContextRef,
741 argumentCount: usize,
742 arguments: *const JSValueRef,
743 exception: *mut JSValueRef,
744 ) -> JSObjectRef;
745}
746extern "C" {
747 #[doc = "@function\n@abstract Creates a JavaScript Date object, as if by invoking the built-in Date constructor.\n@param ctx The execution context to use.\n@param argumentCount An integer count of the number of arguments in arguments.\n@param arguments A JSValue array of arguments to pass to the Date Constructor. Pass NULL if argumentCount is 0.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObject that is a Date."]
748 pub fn JSObjectMakeDate(
749 ctx: JSContextRef,
750 argumentCount: usize,
751 arguments: *const JSValueRef,
752 exception: *mut JSValueRef,
753 ) -> JSObjectRef;
754}
755extern "C" {
756 #[doc = "@function\n@abstract Creates a JavaScript Error object, as if by invoking the built-in Error constructor.\n@param ctx The execution context to use.\n@param argumentCount An integer count of the number of arguments in arguments.\n@param arguments A JSValue array of arguments to pass to the Error Constructor. Pass NULL if argumentCount is 0.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObject that is an Error."]
757 pub fn JSObjectMakeError(
758 ctx: JSContextRef,
759 argumentCount: usize,
760 arguments: *const JSValueRef,
761 exception: *mut JSValueRef,
762 ) -> JSObjectRef;
763}
764extern "C" {
765 #[doc = "@function\n@abstract Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.\n@param ctx The execution context to use.\n@param argumentCount An integer count of the number of arguments in arguments.\n@param arguments A JSValue array of arguments to pass to the RegExp Constructor. Pass NULL if argumentCount is 0.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObject that is a RegExp."]
766 pub fn JSObjectMakeRegExp(
767 ctx: JSContextRef,
768 argumentCount: usize,
769 arguments: *const JSValueRef,
770 exception: *mut JSValueRef,
771 ) -> JSObjectRef;
772}
773extern "C" {
774 #[doc = "@function\n@abstract Creates a JavaScript promise object by invoking the provided executor.\n@param ctx The execution context to use.\n@param resolve A pointer to a JSObjectRef in which to store the resolve function for the new promise. Pass NULL if you do not care to store the resolve callback.\n@param reject A pointer to a JSObjectRef in which to store the reject function for the new promise. Pass NULL if you do not care to store the reject callback.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObject that is a promise or NULL if an exception occurred."]
775 pub fn JSObjectMakeDeferredPromise(
776 ctx: JSContextRef,
777 resolve: *mut JSObjectRef,
778 reject: *mut JSObjectRef,
779 exception: *mut JSValueRef,
780 ) -> JSObjectRef;
781}
782extern "C" {
783 #[doc = "@function\n@abstract Creates a function with a given script as its body.\n@param ctx The execution context to use.\n@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function.\n@param parameterCount An integer count of the number of parameter names in parameterNames.\n@param parameterNames A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0.\n@param body A JSString containing the script to use as the function's body.\n@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.\n@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1.\n@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.\n@result A JSObject that is a function, or NULL if either body or parameterNames contains a syntax error. The object's prototype will be the default function prototype.\n@discussion Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution."]
784 pub fn JSObjectMakeFunction(
785 ctx: JSContextRef,
786 name: JSStringRef,
787 parameterCount: ::std::os::raw::c_uint,
788 parameterNames: *const JSStringRef,
789 body: JSStringRef,
790 sourceURL: JSStringRef,
791 startingLineNumber: ::std::os::raw::c_int,
792 exception: *mut JSValueRef,
793 ) -> JSObjectRef;
794}
795extern "C" {
796 #[doc = "@function\n@abstract Gets an object's prototype.\n@param ctx The execution context to use.\n@param object A JSObject whose prototype you want to get.\n@result A JSValue that is the object's prototype."]
797 pub fn JSObjectGetPrototype(ctx: JSContextRef, object: JSObjectRef) -> JSValueRef;
798}
799extern "C" {
800 #[doc = "@function\n@abstract Sets an object's prototype.\n@param ctx The execution context to use.\n@param object The JSObject whose prototype you want to set.\n@param value A JSValue to set as the object's prototype."]
801 pub fn JSObjectSetPrototype(ctx: JSContextRef, object: JSObjectRef, value: JSValueRef);
802}
803extern "C" {
804 #[doc = "@function\n@abstract Tests whether an object has a given property.\n@param object The JSObject to test.\n@param propertyName A JSString containing the property's name.\n@result true if the object has a property whose name matches propertyName, otherwise false."]
805 pub fn JSObjectHasProperty(
806 ctx: JSContextRef,
807 object: JSObjectRef,
808 propertyName: JSStringRef,
809 ) -> bool;
810}
811extern "C" {
812 #[doc = "@function\n@abstract Gets a property from an object.\n@param ctx The execution context to use.\n@param object The JSObject whose property you want to get.\n@param propertyName A JSString containing the property's name.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The property's value if object has the property, otherwise the undefined value."]
813 pub fn JSObjectGetProperty(
814 ctx: JSContextRef,
815 object: JSObjectRef,
816 propertyName: JSStringRef,
817 exception: *mut JSValueRef,
818 ) -> JSValueRef;
819}
820extern "C" {
821 #[doc = "@function\n@abstract Sets a property on an object.\n@param ctx The execution context to use.\n@param object The JSObject whose property you want to set.\n@param propertyName A JSString containing the property's name.\n@param value A JSValueRef to use as the property's value.\n@param attributes A logically ORed set of JSPropertyAttributes to give to the property.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception."]
822 pub fn JSObjectSetProperty(
823 ctx: JSContextRef,
824 object: JSObjectRef,
825 propertyName: JSStringRef,
826 value: JSValueRef,
827 attributes: JSPropertyAttributes,
828 exception: *mut JSValueRef,
829 );
830}
831extern "C" {
832 #[doc = "@function\n@abstract Deletes a property from an object.\n@param ctx The execution context to use.\n@param object The JSObject whose property you want to delete.\n@param propertyName A JSString containing the property's name.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set)."]
833 pub fn JSObjectDeleteProperty(
834 ctx: JSContextRef,
835 object: JSObjectRef,
836 propertyName: JSStringRef,
837 exception: *mut JSValueRef,
838 ) -> bool;
839}
840extern "C" {
841 #[doc = "@function\n@abstract Tests whether an object has a given property using a JSValueRef as the property key.\n@param object The JSObject to test.\n@param propertyKey A JSValueRef containing the property key to use when looking up the property.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result true if the object has a property whose name matches propertyKey, otherwise false.\n@discussion This function is the same as performing \"propertyKey in object\" from JavaScript."]
842 pub fn JSObjectHasPropertyForKey(
843 ctx: JSContextRef,
844 object: JSObjectRef,
845 propertyKey: JSValueRef,
846 exception: *mut JSValueRef,
847 ) -> bool;
848}
849extern "C" {
850 #[doc = "@function\n@abstract Gets a property from an object using a JSValueRef as the property key.\n@param ctx The execution context to use.\n@param object The JSObject whose property you want to get.\n@param propertyKey A JSValueRef containing the property key to use when looking up the property.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The property's value if object has the property key, otherwise the undefined value.\n@discussion This function is the same as performing \"object[propertyKey]\" from JavaScript."]
851 pub fn JSObjectGetPropertyForKey(
852 ctx: JSContextRef,
853 object: JSObjectRef,
854 propertyKey: JSValueRef,
855 exception: *mut JSValueRef,
856 ) -> JSValueRef;
857}
858extern "C" {
859 #[doc = "@function\n@abstract Sets a property on an object using a JSValueRef as the property key.\n@param ctx The execution context to use.\n@param object The JSObject whose property you want to set.\n@param propertyKey A JSValueRef containing the property key to use when looking up the property.\n@param value A JSValueRef to use as the property's value.\n@param attributes A logically ORed set of JSPropertyAttributes to give to the property.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@discussion This function is the same as performing \"object[propertyKey] = value\" from JavaScript."]
860 pub fn JSObjectSetPropertyForKey(
861 ctx: JSContextRef,
862 object: JSObjectRef,
863 propertyKey: JSValueRef,
864 value: JSValueRef,
865 attributes: JSPropertyAttributes,
866 exception: *mut JSValueRef,
867 );
868}
869extern "C" {
870 #[doc = "@function\n@abstract Deletes a property from an object using a JSValueRef as the property key.\n@param ctx The execution context to use.\n@param object The JSObject whose property you want to delete.\n@param propertyKey A JSValueRef containing the property key to use when looking up the property.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set).\n@discussion This function is the same as performing \"delete object[propertyKey]\" from JavaScript."]
871 pub fn JSObjectDeletePropertyForKey(
872 ctx: JSContextRef,
873 object: JSObjectRef,
874 propertyKey: JSValueRef,
875 exception: *mut JSValueRef,
876 ) -> bool;
877}
878extern "C" {
879 #[doc = "@function\n@abstract Gets a property from an object by numeric index.\n@param ctx The execution context to use.\n@param object The JSObject whose property you want to get.\n@param propertyIndex An integer value that is the property's name.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The property's value if object has the property, otherwise the undefined value.\n@discussion Calling JSObjectGetPropertyAtIndex is equivalent to calling JSObjectGetProperty with a string containing propertyIndex, but JSObjectGetPropertyAtIndex provides optimized access to numeric properties."]
880 pub fn JSObjectGetPropertyAtIndex(
881 ctx: JSContextRef,
882 object: JSObjectRef,
883 propertyIndex: ::std::os::raw::c_uint,
884 exception: *mut JSValueRef,
885 ) -> JSValueRef;
886}
887extern "C" {
888 #[doc = "@function\n@abstract Sets a property on an object by numeric index.\n@param ctx The execution context to use.\n@param object The JSObject whose property you want to set.\n@param propertyIndex The property's name as a number.\n@param value A JSValue to use as the property's value.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@discussion Calling JSObjectSetPropertyAtIndex is equivalent to calling JSObjectSetProperty with a string containing propertyIndex, but JSObjectSetPropertyAtIndex provides optimized access to numeric properties."]
889 pub fn JSObjectSetPropertyAtIndex(
890 ctx: JSContextRef,
891 object: JSObjectRef,
892 propertyIndex: ::std::os::raw::c_uint,
893 value: JSValueRef,
894 exception: *mut JSValueRef,
895 );
896}
897extern "C" {
898 #[doc = "@function\n@abstract Gets an object's private data.\n@param object A JSObject whose private data you want to get.\n@result A void* that is the object's private data, if the object has private data, otherwise NULL."]
899 pub fn JSObjectGetPrivate(object: JSObjectRef) -> *mut ::std::os::raw::c_void;
900}
901extern "C" {
902 #[doc = "@function\n@abstract Sets a pointer to private data on an object.\n@param object The JSObject whose private data you want to set.\n@param data A void* to set as the object's private data.\n@result true if object can store private data, otherwise false.\n@discussion The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data."]
903 pub fn JSObjectSetPrivate(object: JSObjectRef, data: *mut ::std::os::raw::c_void) -> bool;
904}
905extern "C" {
906 #[doc = "@function\n@abstract Tests whether an object can be called as a function.\n@param ctx The execution context to use.\n@param object The JSObject to test.\n@result true if the object can be called as a function, otherwise false."]
907 pub fn JSObjectIsFunction(ctx: JSContextRef, object: JSObjectRef) -> bool;
908}
909extern "C" {
910 #[doc = "@function\n@abstract Calls an object as a function.\n@param ctx The execution context to use.\n@param object The JSObject to call as a function.\n@param thisObject The object to use as \"this,\" or NULL to use the global object as \"this.\"\n@param argumentCount An integer count of the number of arguments in arguments.\n@param arguments A JSValue array of arguments to pass to the function. Pass NULL if argumentCount is 0.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The JSValue that results from calling object as a function, or NULL if an exception is thrown or object is not a function."]
911 pub fn JSObjectCallAsFunction(
912 ctx: JSContextRef,
913 object: JSObjectRef,
914 thisObject: JSObjectRef,
915 argumentCount: usize,
916 arguments: *const JSValueRef,
917 exception: *mut JSValueRef,
918 ) -> JSValueRef;
919}
920extern "C" {
921 #[doc = "@function\n@abstract Tests whether an object can be called as a constructor.\n@param ctx The execution context to use.\n@param object The JSObject to test.\n@result true if the object can be called as a constructor, otherwise false."]
922 pub fn JSObjectIsConstructor(ctx: JSContextRef, object: JSObjectRef) -> bool;
923}
924extern "C" {
925 #[doc = "@function\n@abstract Calls an object as a constructor.\n@param ctx The execution context to use.\n@param object The JSObject to call as a constructor.\n@param argumentCount An integer count of the number of arguments in arguments.\n@param arguments A JSValue array of arguments to pass to the constructor. Pass NULL if argumentCount is 0.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The JSObject that results from calling object as a constructor, or NULL if an exception is thrown or object is not a constructor."]
926 pub fn JSObjectCallAsConstructor(
927 ctx: JSContextRef,
928 object: JSObjectRef,
929 argumentCount: usize,
930 arguments: *const JSValueRef,
931 exception: *mut JSValueRef,
932 ) -> JSObjectRef;
933}
934extern "C" {
935 #[doc = "@function\n@abstract Gets the names of an object's enumerable properties.\n@param ctx The execution context to use.\n@param object The object whose property names you want to get.\n@result A JSPropertyNameArray containing the names object's enumerable properties. Ownership follows the Create Rule."]
936 pub fn JSObjectCopyPropertyNames(
937 ctx: JSContextRef,
938 object: JSObjectRef,
939 ) -> JSPropertyNameArrayRef;
940}
941extern "C" {
942 #[doc = "@function\n@abstract Retains a JavaScript property name array.\n@param array The JSPropertyNameArray to retain.\n@result A JSPropertyNameArray that is the same as array."]
943 pub fn JSPropertyNameArrayRetain(array: JSPropertyNameArrayRef) -> JSPropertyNameArrayRef;
944}
945extern "C" {
946 #[doc = "@function\n@abstract Releases a JavaScript property name array.\n@param array The JSPropetyNameArray to release."]
947 pub fn JSPropertyNameArrayRelease(array: JSPropertyNameArrayRef);
948}
949extern "C" {
950 #[doc = "@function\n@abstract Gets a count of the number of items in a JavaScript property name array.\n@param array The array from which to retrieve the count.\n@result An integer count of the number of names in array."]
951 pub fn JSPropertyNameArrayGetCount(array: JSPropertyNameArrayRef) -> usize;
952}
953extern "C" {
954 #[doc = "@function\n@abstract Gets a property name at a given index in a JavaScript property name array.\n@param array The array from which to retrieve the property name.\n@param index The index of the property name to retrieve.\n@result A JSStringRef containing the property name."]
955 pub fn JSPropertyNameArrayGetNameAtIndex(
956 array: JSPropertyNameArrayRef,
957 index: usize,
958 ) -> JSStringRef;
959}
960extern "C" {
961 #[doc = "@function\n@abstract Adds a property name to a JavaScript property name accumulator.\n@param accumulator The accumulator object to which to add the property name.\n@param propertyName The property name to add."]
962 pub fn JSPropertyNameAccumulatorAddName(
963 accumulator: JSPropertyNameAccumulatorRef,
964 propertyName: JSStringRef,
965 );
966}
967extern "C" {
968 #[doc = "@function\n@abstract Creates a JavaScript context group.\n@discussion A JSContextGroup associates JavaScript contexts with one another.\nContexts in the same group may share and exchange JavaScript objects. Sharing and/or exchanging\nJavaScript objects between contexts in different groups will produce undefined behavior.\nWhen objects from the same context group are used in multiple threads, explicit\nsynchronization is required.\n\nA JSContextGroup may need to run deferred tasks on a run loop, such as garbage collection\nor resolving WebAssembly compilations. By default, calling JSContextGroupCreate will use\nthe run loop of the thread it was called on. Currently, there is no API to change a\nJSContextGroup's run loop once it has been created.\n@result The created JSContextGroup."]
969 pub fn JSContextGroupCreate() -> JSContextGroupRef;
970}
971extern "C" {
972 #[doc = "@function\n@abstract Retains a JavaScript context group.\n@param group The JSContextGroup to retain.\n@result A JSContextGroup that is the same as group."]
973 pub fn JSContextGroupRetain(group: JSContextGroupRef) -> JSContextGroupRef;
974}
975extern "C" {
976 #[doc = "@function\n@abstract Releases a JavaScript context group.\n@param group The JSContextGroup to release."]
977 pub fn JSContextGroupRelease(group: JSContextGroupRef);
978}
979extern "C" {
980 #[doc = "@function\n@abstract Creates a global JavaScript execution context.\n@discussion JSGlobalContextCreate allocates a global object and populates it with all the\nbuilt-in JavaScript objects, such as Object, Function, String, and Array.\n\nIn WebKit version 4.0 and later, the context is created in a unique context group.\nTherefore, scripts may execute in it concurrently with scripts executing in other contexts.\nHowever, you may not use values created in the context in other contexts.\n@param globalObjectClass The class to use when creating the global object. Pass\nNULL to use the default object class.\n@result A JSGlobalContext with a global object of class globalObjectClass."]
981 pub fn JSGlobalContextCreate(globalObjectClass: JSClassRef) -> JSGlobalContextRef;
982}
983extern "C" {
984 #[doc = "@function\n@abstract Creates a global JavaScript execution context in the context group provided.\n@discussion JSGlobalContextCreateInGroup allocates a global object and populates it with\nall the built-in JavaScript objects, such as Object, Function, String, and Array.\n@param globalObjectClass The class to use when creating the global object. Pass\nNULL to use the default object class.\n@param group The context group to use. The created global context retains the group.\nPass NULL to create a unique group for the context.\n@result A JSGlobalContext with a global object of class globalObjectClass and a context\ngroup equal to group."]
985 pub fn JSGlobalContextCreateInGroup(
986 group: JSContextGroupRef,
987 globalObjectClass: JSClassRef,
988 ) -> JSGlobalContextRef;
989}
990extern "C" {
991 #[doc = "@function\n@abstract Retains a global JavaScript execution context.\n@param ctx The JSGlobalContext to retain.\n@result A JSGlobalContext that is the same as ctx."]
992 pub fn JSGlobalContextRetain(ctx: JSGlobalContextRef) -> JSGlobalContextRef;
993}
994extern "C" {
995 #[doc = "@function\n@abstract Releases a global JavaScript execution context.\n@param ctx The JSGlobalContext to release."]
996 pub fn JSGlobalContextRelease(ctx: JSGlobalContextRef);
997}
998extern "C" {
999 #[doc = "@function\n@abstract Gets the global object of a JavaScript execution context.\n@param ctx The JSContext whose global object you want to get.\n@result ctx's global object."]
1000 pub fn JSContextGetGlobalObject(ctx: JSContextRef) -> JSObjectRef;
1001}
1002extern "C" {
1003 #[doc = "@function\n@abstract Gets the context group to which a JavaScript execution context belongs.\n@param ctx The JSContext whose group you want to get.\n@result ctx's group."]
1004 pub fn JSContextGetGroup(ctx: JSContextRef) -> JSContextGroupRef;
1005}
1006extern "C" {
1007 #[doc = "@function\n@abstract Gets the global context of a JavaScript execution context.\n@param ctx The JSContext whose global context you want to get.\n@result ctx's global context."]
1008 pub fn JSContextGetGlobalContext(ctx: JSContextRef) -> JSGlobalContextRef;
1009}
1010extern "C" {
1011 #[doc = "@function\n@abstract Gets a copy of the name of a context.\n@param ctx The JSGlobalContext whose name you want to get.\n@result The name for ctx.\n@discussion A JSGlobalContext's name is exposed when inspecting the context to make it easier to identify the context you would like to inspect."]
1012 pub fn JSGlobalContextCopyName(ctx: JSGlobalContextRef) -> JSStringRef;
1013}
1014extern "C" {
1015 #[doc = "@function\n@abstract Sets the name exposed when inspecting a context.\n@param ctx The JSGlobalContext that you want to name.\n@param name The name to set on the context."]
1016 pub fn JSGlobalContextSetName(ctx: JSGlobalContextRef, name: JSStringRef);
1017}
1018extern "C" {
1019 #[doc = "@function\n@abstract Gets whether the context is inspectable in Web Inspector.\n@param ctx The JSGlobalContext that you want to change the inspectability of.\n@result Whether the context is inspectable in Web Inspector."]
1020 pub fn JSGlobalContextIsInspectable(ctx: JSGlobalContextRef) -> bool;
1021}
1022extern "C" {
1023 #[doc = "@function\n@abstract Sets whether the context is inspectable in Web Inspector. Default value is NO.\n@param ctx The JSGlobalContext that you want to change the inspectability of.\n@param inspectable YES to allow Web Inspector to connect to the context, otherwise NO."]
1024 pub fn JSGlobalContextSetInspectable(ctx: JSGlobalContextRef, inspectable: bool);
1025}
1026#[doc = "@typedef JSChar\n@abstract A UTF-16 code unit. One, or a sequence of two, can encode any Unicode\ncharacter. As with all scalar types, endianness depends on the underlying\narchitecture."]
1027pub type JSChar = ::std::os::raw::c_ushort;
1028extern "C" {
1029 #[doc = "@function\n@abstract Creates a JavaScript string from a buffer of Unicode characters.\n@param chars The buffer of Unicode characters to copy into the new JSString.\n@param numChars The number of characters to copy from the buffer pointed to by chars.\n@result A JSString containing chars. Ownership follows the Create Rule."]
1030 pub fn JSStringCreateWithCharacters(chars: *const JSChar, numChars: usize) -> JSStringRef;
1031}
1032extern "C" {
1033 #[doc = "@function\n@abstract Creates a JavaScript string from a null-terminated UTF8 string.\n@param string The null-terminated UTF8 string to copy into the new JSString.\n@result A JSString containing string. Ownership follows the Create Rule."]
1034 pub fn JSStringCreateWithUTF8CString(string: *const ::std::os::raw::c_char) -> JSStringRef;
1035}
1036extern "C" {
1037 #[doc = "@function\n@abstract Retains a JavaScript string.\n@param string The JSString to retain.\n@result A JSString that is the same as string."]
1038 pub fn JSStringRetain(string: JSStringRef) -> JSStringRef;
1039}
1040extern "C" {
1041 #[doc = "@function\n@abstract Releases a JavaScript string.\n@param string The JSString to release."]
1042 pub fn JSStringRelease(string: JSStringRef);
1043}
1044extern "C" {
1045 #[doc = "@function\n@abstract Returns the number of Unicode characters in a JavaScript string.\n@param string The JSString whose length (in Unicode characters) you want to know.\n@result The number of Unicode characters stored in string."]
1046 pub fn JSStringGetLength(string: JSStringRef) -> usize;
1047}
1048extern "C" {
1049 #[doc = "@function\n@abstract Returns a pointer to the Unicode character buffer that\nserves as the backing store for a JavaScript string.\n@param string The JSString whose backing store you want to access.\n@result A pointer to the Unicode character buffer that serves as string's\nbacking store, which will be deallocated when string is deallocated."]
1050 pub fn JSStringGetCharactersPtr(string: JSStringRef) -> *const JSChar;
1051}
1052extern "C" {
1053 #[doc = "@function\n@abstract Returns the maximum number of bytes a JavaScript string will\ntake up if converted into a null-terminated UTF8 string.\n@param string The JSString whose maximum converted size (in bytes) you\nwant to know.\n@result The maximum number of bytes that could be required to convert string into a\nnull-terminated UTF8 string. The number of bytes that the conversion actually ends\nup requiring could be less than this, but never more."]
1054 pub fn JSStringGetMaximumUTF8CStringSize(string: JSStringRef) -> usize;
1055}
1056extern "C" {
1057 #[doc = "@function\n@abstract Converts a JavaScript string into a null-terminated UTF8 string,\nand copies the result into an external byte buffer.\n@param string The source JSString.\n@param buffer The destination byte buffer into which to copy a null-terminated\nUTF8 representation of string. On return, buffer contains a UTF8 string\nrepresentation of string. If bufferSize is too small, buffer will contain only\npartial results. If buffer is not at least bufferSize bytes in size,\nbehavior is undefined.\n@param bufferSize The size of the external buffer in bytes.\n@result The number of bytes written into buffer (including the null-terminator byte)."]
1058 pub fn JSStringGetUTF8CString(
1059 string: JSStringRef,
1060 buffer: *mut ::std::os::raw::c_char,
1061 bufferSize: usize,
1062 ) -> usize;
1063}
1064extern "C" {
1065 #[doc = "@function\n@abstract Tests whether two JavaScript strings match.\n@param a The first JSString to test.\n@param b The second JSString to test.\n@result true if the two strings match, otherwise false."]
1066 pub fn JSStringIsEqual(a: JSStringRef, b: JSStringRef) -> bool;
1067}
1068extern "C" {
1069 #[doc = "@function\n@abstract Tests whether a JavaScript string matches a null-terminated UTF8 string.\n@param a The JSString to test.\n@param b The null-terminated UTF8 string to test.\n@result true if the two strings match, otherwise false."]
1070 pub fn JSStringIsEqualToUTF8CString(a: JSStringRef, b: *const ::std::os::raw::c_char) -> bool;
1071}
1072extern "C" {
1073 #[doc = "@function\n@abstract Creates a JavaScript Typed Array object with the given number of elements.\n@param ctx The execution context to use.\n@param arrayType A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned.\n@param length The number of elements to be in the new Typed Array.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObjectRef that is a Typed Array with all elements set to zero or NULL if there was an error."]
1074 pub fn JSObjectMakeTypedArray(
1075 ctx: JSContextRef,
1076 arrayType: JSTypedArrayType,
1077 length: usize,
1078 exception: *mut JSValueRef,
1079 ) -> JSObjectRef;
1080}
1081extern "C" {
1082 #[doc = "@function\n@abstract Creates a JavaScript Typed Array object from an existing pointer.\n@param ctx The execution context to use.\n@param arrayType A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned.\n@param bytes A pointer to the byte buffer to be used as the backing store of the Typed Array object.\n@param byteLength The number of bytes pointed to by the parameter bytes.\n@param bytesDeallocator The allocator to use to deallocate the external buffer when the JSTypedArrayData object is deallocated.\n@param deallocatorContext A pointer to pass back to the deallocator.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObjectRef Typed Array whose backing store is the same as the one pointed to by bytes or NULL if there was an error.\n@discussion If an exception is thrown during this function the bytesDeallocator will always be called."]
1083 pub fn JSObjectMakeTypedArrayWithBytesNoCopy(
1084 ctx: JSContextRef,
1085 arrayType: JSTypedArrayType,
1086 bytes: *mut ::std::os::raw::c_void,
1087 byteLength: usize,
1088 bytesDeallocator: JSTypedArrayBytesDeallocator,
1089 deallocatorContext: *mut ::std::os::raw::c_void,
1090 exception: *mut JSValueRef,
1091 ) -> JSObjectRef;
1092}
1093extern "C" {
1094 #[doc = "@function\n@abstract Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object.\n@param ctx The execution context to use.\n@param arrayType A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned.\n@param buffer An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObjectRef that is a Typed Array or NULL if there was an error. The backing store of the Typed Array will be buffer."]
1095 pub fn JSObjectMakeTypedArrayWithArrayBuffer(
1096 ctx: JSContextRef,
1097 arrayType: JSTypedArrayType,
1098 buffer: JSObjectRef,
1099 exception: *mut JSValueRef,
1100 ) -> JSObjectRef;
1101}
1102extern "C" {
1103 #[doc = "@function\n@abstract Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object with the given offset and length.\n@param ctx The execution context to use.\n@param arrayType A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned.\n@param buffer An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object.\n@param byteOffset The byte offset for the created Typed Array. byteOffset should aligned with the element size of arrayType.\n@param length The number of elements to include in the Typed Array.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObjectRef that is a Typed Array or NULL if there was an error. The backing store of the Typed Array will be buffer."]
1104 pub fn JSObjectMakeTypedArrayWithArrayBufferAndOffset(
1105 ctx: JSContextRef,
1106 arrayType: JSTypedArrayType,
1107 buffer: JSObjectRef,
1108 byteOffset: usize,
1109 length: usize,
1110 exception: *mut JSValueRef,
1111 ) -> JSObjectRef;
1112}
1113extern "C" {
1114 #[doc = "@function\n@abstract Returns a temporary pointer to the backing store of a JavaScript Typed Array object.\n@param ctx The execution context to use.\n@param object The Typed Array object whose backing store pointer to return.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A pointer to the raw data buffer that serves as object's backing store or NULL if object is not a Typed Array object.\n@discussion The pointer returned by this function is temporary and is not guaranteed to remain valid across JavaScriptCore API calls."]
1115 pub fn JSObjectGetTypedArrayBytesPtr(
1116 ctx: JSContextRef,
1117 object: JSObjectRef,
1118 exception: *mut JSValueRef,
1119 ) -> *mut ::std::os::raw::c_void;
1120}
1121extern "C" {
1122 #[doc = "@function\n@abstract Returns the length of a JavaScript Typed Array object.\n@param ctx The execution context to use.\n@param object The Typed Array object whose length to return.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The length of the Typed Array object or 0 if the object is not a Typed Array object."]
1123 pub fn JSObjectGetTypedArrayLength(
1124 ctx: JSContextRef,
1125 object: JSObjectRef,
1126 exception: *mut JSValueRef,
1127 ) -> usize;
1128}
1129extern "C" {
1130 #[doc = "@function\n@abstract Returns the byte length of a JavaScript Typed Array object.\n@param ctx The execution context to use.\n@param object The Typed Array object whose byte length to return.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The byte length of the Typed Array object or 0 if the object is not a Typed Array object."]
1131 pub fn JSObjectGetTypedArrayByteLength(
1132 ctx: JSContextRef,
1133 object: JSObjectRef,
1134 exception: *mut JSValueRef,
1135 ) -> usize;
1136}
1137extern "C" {
1138 #[doc = "@function\n@abstract Returns the byte offset of a JavaScript Typed Array object.\n@param ctx The execution context to use.\n@param object The Typed Array object whose byte offset to return.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The byte offset of the Typed Array object or 0 if the object is not a Typed Array object."]
1139 pub fn JSObjectGetTypedArrayByteOffset(
1140 ctx: JSContextRef,
1141 object: JSObjectRef,
1142 exception: *mut JSValueRef,
1143 ) -> usize;
1144}
1145extern "C" {
1146 #[doc = "@function\n@abstract Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object.\n@param ctx The execution context to use.\n@param object The JSObjectRef whose Typed Array type data pointer to obtain.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObjectRef with a JSTypedArrayType of kJSTypedArrayTypeArrayBuffer or NULL if object is not a Typed Array."]
1147 pub fn JSObjectGetTypedArrayBuffer(
1148 ctx: JSContextRef,
1149 object: JSObjectRef,
1150 exception: *mut JSValueRef,
1151 ) -> JSObjectRef;
1152}
1153extern "C" {
1154 #[doc = "@function\n@abstract Creates a JavaScript Array Buffer object from an existing pointer.\n@param ctx The execution context to use.\n@param bytes A pointer to the byte buffer to be used as the backing store of the Typed Array object.\n@param byteLength The number of bytes pointed to by the parameter bytes.\n@param bytesDeallocator The allocator to use to deallocate the external buffer when the Typed Array data object is deallocated.\n@param deallocatorContext A pointer to pass back to the deallocator.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A JSObjectRef Array Buffer whose backing store is the same as the one pointed to by bytes or NULL if there was an error.\n@discussion If an exception is thrown during this function the bytesDeallocator will always be called."]
1155 pub fn JSObjectMakeArrayBufferWithBytesNoCopy(
1156 ctx: JSContextRef,
1157 bytes: *mut ::std::os::raw::c_void,
1158 byteLength: usize,
1159 bytesDeallocator: JSTypedArrayBytesDeallocator,
1160 deallocatorContext: *mut ::std::os::raw::c_void,
1161 exception: *mut JSValueRef,
1162 ) -> JSObjectRef;
1163}
1164extern "C" {
1165 #[doc = "@function\n@abstract Returns a pointer to the data buffer that serves as the backing store for a JavaScript Typed Array object.\n@param object The Array Buffer object whose internal backing store pointer to return.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result A pointer to the raw data buffer that serves as object's backing store or NULL if object is not an Array Buffer object.\n@discussion The pointer returned by this function is temporary and is not guaranteed to remain valid across JavaScriptCore API calls."]
1166 pub fn JSObjectGetArrayBufferBytesPtr(
1167 ctx: JSContextRef,
1168 object: JSObjectRef,
1169 exception: *mut JSValueRef,
1170 ) -> *mut ::std::os::raw::c_void;
1171}
1172extern "C" {
1173 #[doc = "@function\n@abstract Returns the number of bytes in a JavaScript data object.\n@param ctx The execution context to use.\n@param object The JS Arary Buffer object whose length in bytes to return.\n@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.\n@result The number of bytes stored in the data object."]
1174 pub fn JSObjectGetArrayBufferByteLength(
1175 ctx: JSContextRef,
1176 object: JSObjectRef,
1177 exception: *mut JSValueRef,
1178 ) -> usize;
1179}
1180pub type ULChar16 = ::std::os::raw::c_ushort;
1181#[repr(C)]
1182#[derive(Debug, Copy, Clone)]
1183pub struct C_Config {
1184 _unused: [u8; 0],
1185}
1186pub type ULConfig = *mut C_Config;
1187#[repr(C)]
1188#[derive(Debug, Copy, Clone)]
1189pub struct C_Renderer {
1190 _unused: [u8; 0],
1191}
1192pub type ULRenderer = *mut C_Renderer;
1193#[repr(C)]
1194#[derive(Debug, Copy, Clone)]
1195pub struct C_Session {
1196 _unused: [u8; 0],
1197}
1198pub type ULSession = *mut C_Session;
1199#[repr(C)]
1200#[derive(Debug, Copy, Clone)]
1201pub struct C_ViewConfig {
1202 _unused: [u8; 0],
1203}
1204pub type ULViewConfig = *mut C_ViewConfig;
1205#[repr(C)]
1206#[derive(Debug, Copy, Clone)]
1207pub struct C_View {
1208 _unused: [u8; 0],
1209}
1210pub type ULView = *mut C_View;
1211#[repr(C)]
1212#[derive(Debug, Copy, Clone)]
1213pub struct C_Bitmap {
1214 _unused: [u8; 0],
1215}
1216pub type ULBitmap = *mut C_Bitmap;
1217#[repr(C)]
1218#[derive(Debug, Copy, Clone)]
1219pub struct C_String {
1220 _unused: [u8; 0],
1221}
1222pub type ULString = *mut C_String;
1223#[repr(C)]
1224#[derive(Debug, Copy, Clone)]
1225pub struct C_Buffer {
1226 _unused: [u8; 0],
1227}
1228pub type ULBuffer = *mut C_Buffer;
1229#[repr(C)]
1230#[derive(Debug, Copy, Clone)]
1231pub struct C_KeyEvent {
1232 _unused: [u8; 0],
1233}
1234pub type ULKeyEvent = *mut C_KeyEvent;
1235#[repr(C)]
1236#[derive(Debug, Copy, Clone)]
1237pub struct C_MouseEvent {
1238 _unused: [u8; 0],
1239}
1240pub type ULMouseEvent = *mut C_MouseEvent;
1241#[repr(C)]
1242#[derive(Debug, Copy, Clone)]
1243pub struct C_ScrollEvent {
1244 _unused: [u8; 0],
1245}
1246pub type ULScrollEvent = *mut C_ScrollEvent;
1247#[repr(C)]
1248#[derive(Debug, Copy, Clone)]
1249pub struct C_GamepadEvent {
1250 _unused: [u8; 0],
1251}
1252pub type ULGamepadEvent = *mut C_GamepadEvent;
1253#[repr(C)]
1254#[derive(Debug, Copy, Clone)]
1255pub struct C_GamepadAxisEvent {
1256 _unused: [u8; 0],
1257}
1258pub type ULGamepadAxisEvent = *mut C_GamepadAxisEvent;
1259#[repr(C)]
1260#[derive(Debug, Copy, Clone)]
1261pub struct C_GamepadButtonEvent {
1262 _unused: [u8; 0],
1263}
1264pub type ULGamepadButtonEvent = *mut C_GamepadButtonEvent;
1265#[repr(C)]
1266#[derive(Debug, Copy, Clone)]
1267pub struct C_Surface {
1268 _unused: [u8; 0],
1269}
1270pub type ULSurface = *mut C_Surface;
1271pub type ULBitmapSurface = *mut C_Surface;
1272#[repr(C)]
1273#[derive(Debug, Copy, Clone)]
1274pub struct C_FontFile {
1275 _unused: [u8; 0],
1276}
1277pub type ULFontFile = *mut C_FontFile;
1278pub const ULMessageSource_kMessageSource_XML: ULMessageSource = 0;
1279pub const ULMessageSource_kMessageSource_JS: ULMessageSource = 1;
1280pub const ULMessageSource_kMessageSource_Network: ULMessageSource = 2;
1281pub const ULMessageSource_kMessageSource_ConsoleAPI: ULMessageSource = 3;
1282pub const ULMessageSource_kMessageSource_Storage: ULMessageSource = 4;
1283pub const ULMessageSource_kMessageSource_AppCache: ULMessageSource = 5;
1284pub const ULMessageSource_kMessageSource_Rendering: ULMessageSource = 6;
1285pub const ULMessageSource_kMessageSource_CSS: ULMessageSource = 7;
1286pub const ULMessageSource_kMessageSource_Security: ULMessageSource = 8;
1287pub const ULMessageSource_kMessageSource_ContentBlocker: ULMessageSource = 9;
1288pub const ULMessageSource_kMessageSource_Other: ULMessageSource = 10;
1289pub type ULMessageSource = ::std::os::raw::c_uint;
1290pub const ULMessageLevel_kMessageLevel_Log: ULMessageLevel = 1;
1291pub const ULMessageLevel_kMessageLevel_Warning: ULMessageLevel = 2;
1292pub const ULMessageLevel_kMessageLevel_Error: ULMessageLevel = 3;
1293pub const ULMessageLevel_kMessageLevel_Debug: ULMessageLevel = 4;
1294pub const ULMessageLevel_kMessageLevel_Info: ULMessageLevel = 5;
1295pub type ULMessageLevel = ::std::os::raw::c_uint;
1296pub const ULCursor_kCursor_Pointer: ULCursor = 0;
1297pub const ULCursor_kCursor_Cross: ULCursor = 1;
1298pub const ULCursor_kCursor_Hand: ULCursor = 2;
1299pub const ULCursor_kCursor_IBeam: ULCursor = 3;
1300pub const ULCursor_kCursor_Wait: ULCursor = 4;
1301pub const ULCursor_kCursor_Help: ULCursor = 5;
1302pub const ULCursor_kCursor_EastResize: ULCursor = 6;
1303pub const ULCursor_kCursor_NorthResize: ULCursor = 7;
1304pub const ULCursor_kCursor_NorthEastResize: ULCursor = 8;
1305pub const ULCursor_kCursor_NorthWestResize: ULCursor = 9;
1306pub const ULCursor_kCursor_SouthResize: ULCursor = 10;
1307pub const ULCursor_kCursor_SouthEastResize: ULCursor = 11;
1308pub const ULCursor_kCursor_SouthWestResize: ULCursor = 12;
1309pub const ULCursor_kCursor_WestResize: ULCursor = 13;
1310pub const ULCursor_kCursor_NorthSouthResize: ULCursor = 14;
1311pub const ULCursor_kCursor_EastWestResize: ULCursor = 15;
1312pub const ULCursor_kCursor_NorthEastSouthWestResize: ULCursor = 16;
1313pub const ULCursor_kCursor_NorthWestSouthEastResize: ULCursor = 17;
1314pub const ULCursor_kCursor_ColumnResize: ULCursor = 18;
1315pub const ULCursor_kCursor_RowResize: ULCursor = 19;
1316pub const ULCursor_kCursor_MiddlePanning: ULCursor = 20;
1317pub const ULCursor_kCursor_EastPanning: ULCursor = 21;
1318pub const ULCursor_kCursor_NorthPanning: ULCursor = 22;
1319pub const ULCursor_kCursor_NorthEastPanning: ULCursor = 23;
1320pub const ULCursor_kCursor_NorthWestPanning: ULCursor = 24;
1321pub const ULCursor_kCursor_SouthPanning: ULCursor = 25;
1322pub const ULCursor_kCursor_SouthEastPanning: ULCursor = 26;
1323pub const ULCursor_kCursor_SouthWestPanning: ULCursor = 27;
1324pub const ULCursor_kCursor_WestPanning: ULCursor = 28;
1325pub const ULCursor_kCursor_Move: ULCursor = 29;
1326pub const ULCursor_kCursor_VerticalText: ULCursor = 30;
1327pub const ULCursor_kCursor_Cell: ULCursor = 31;
1328pub const ULCursor_kCursor_ContextMenu: ULCursor = 32;
1329pub const ULCursor_kCursor_Alias: ULCursor = 33;
1330pub const ULCursor_kCursor_Progress: ULCursor = 34;
1331pub const ULCursor_kCursor_NoDrop: ULCursor = 35;
1332pub const ULCursor_kCursor_Copy: ULCursor = 36;
1333pub const ULCursor_kCursor_None: ULCursor = 37;
1334pub const ULCursor_kCursor_NotAllowed: ULCursor = 38;
1335pub const ULCursor_kCursor_ZoomIn: ULCursor = 39;
1336pub const ULCursor_kCursor_ZoomOut: ULCursor = 40;
1337pub const ULCursor_kCursor_Grab: ULCursor = 41;
1338pub const ULCursor_kCursor_Grabbing: ULCursor = 42;
1339pub const ULCursor_kCursor_Custom: ULCursor = 43;
1340pub type ULCursor = ::std::os::raw::c_uint;
1341#[doc = "\n Alpha channel only, 8-bits per pixel.\n\n Encoding: 8-bits per channel, unsigned normalized.\n\n Color-space: Linear (no gamma), alpha-coverage only.\n"]
1342pub const ULBitmapFormat_kBitmapFormat_A8_UNORM: ULBitmapFormat = 0;
1343#[doc = "\n Blue Green Red Alpha channels, 32-bits per pixel.\n\n Encoding: 8-bits per channel, unsigned normalized.\n\n Color-space: sRGB gamma with premultiplied linear alpha channel.\n"]
1344pub const ULBitmapFormat_kBitmapFormat_BGRA8_UNORM_SRGB: ULBitmapFormat = 1;
1345pub type ULBitmapFormat = ::std::os::raw::c_uint;
1346#[doc = "\n Key-Down event type. (Does not trigger accelerator commands in WebCore)\n\n @NOTE: You should probably use RawKeyDown instead when a physical key\n is pressed. This member is only here for historic compatibility\n with WebCore's key event types.\n"]
1347pub const ULKeyEventType_kKeyEventType_KeyDown: ULKeyEventType = 0;
1348#[doc = "\n Key-Up event type. Use this when a physical key is released.\n"]
1349pub const ULKeyEventType_kKeyEventType_KeyUp: ULKeyEventType = 1;
1350#[doc = "\n Raw Key-Down type. Use this when a physical key is pressed.\n\n @NOTE: You should use RawKeyDown for physical key presses since it\n allows WebCore to do additional command translation.\n"]
1351pub const ULKeyEventType_kKeyEventType_RawKeyDown: ULKeyEventType = 2;
1352#[doc = "\n Character input event type. Use this when the OS generates text from\n a physical key being pressed (eg, WM_CHAR on Windows).\n"]
1353pub const ULKeyEventType_kKeyEventType_Char: ULKeyEventType = 3;
1354pub type ULKeyEventType = ::std::os::raw::c_uint;
1355pub const ULMouseEventType_kMouseEventType_MouseMoved: ULMouseEventType = 0;
1356pub const ULMouseEventType_kMouseEventType_MouseDown: ULMouseEventType = 1;
1357pub const ULMouseEventType_kMouseEventType_MouseUp: ULMouseEventType = 2;
1358pub type ULMouseEventType = ::std::os::raw::c_uint;
1359pub const ULMouseButton_kMouseButton_None: ULMouseButton = 0;
1360pub const ULMouseButton_kMouseButton_Left: ULMouseButton = 1;
1361pub const ULMouseButton_kMouseButton_Middle: ULMouseButton = 2;
1362pub const ULMouseButton_kMouseButton_Right: ULMouseButton = 3;
1363pub type ULMouseButton = ::std::os::raw::c_uint;
1364pub const ULScrollEventType_kScrollEventType_ScrollByPixel: ULScrollEventType = 0;
1365pub const ULScrollEventType_kScrollEventType_ScrollByPage: ULScrollEventType = 1;
1366pub type ULScrollEventType = ::std::os::raw::c_uint;
1367pub const ULGamepadEventType_kGamepadEventType_Connected: ULGamepadEventType = 0;
1368pub const ULGamepadEventType_kGamepadEventType_Disconnected: ULGamepadEventType = 1;
1369pub type ULGamepadEventType = ::std::os::raw::c_uint;
1370pub const ULFaceWinding_kFaceWinding_Clockwise: ULFaceWinding = 0;
1371pub const ULFaceWinding_kFaceWinding_CounterClockwise: ULFaceWinding = 1;
1372pub type ULFaceWinding = ::std::os::raw::c_uint;
1373#[doc = "\n Lighter hinting algorithm-- glyphs are slightly fuzzier but better\n resemble their original shape. This is achieved by snapping glyphs to the\n pixel grid only vertically which better preserves inter-glyph spacing.\n"]
1374pub const ULFontHinting_kFontHinting_Smooth: ULFontHinting = 0;
1375#[doc = "\n Default hinting algorithm-- offers a good balance between sharpness and\n shape at smaller font sizes.\n"]
1376pub const ULFontHinting_kFontHinting_Normal: ULFontHinting = 1;
1377#[doc = "\n Strongest hinting algorithm-- outputs only black/white glyphs. The result\n is usually unpleasant if the underlying TTF does not contain hints for\n this type of rendering.\n"]
1378pub const ULFontHinting_kFontHinting_Monochrome: ULFontHinting = 2;
1379pub type ULFontHinting = ::std::os::raw::c_uint;
1380#[repr(C)]
1381#[derive(Debug, Default, Copy, Clone)]
1382pub struct ULRect {
1383 pub left: f32,
1384 pub top: f32,
1385 pub right: f32,
1386 pub bottom: f32,
1387}
1388#[test]
1389fn bindgen_test_layout_ULRect() {
1390 const UNINIT: ::std::mem::MaybeUninit<ULRect> = ::std::mem::MaybeUninit::uninit();
1391 let ptr = UNINIT.as_ptr();
1392 assert_eq!(
1393 ::std::mem::size_of::<ULRect>(),
1394 16usize,
1395 concat!("Size of: ", stringify!(ULRect))
1396 );
1397 assert_eq!(
1398 ::std::mem::align_of::<ULRect>(),
1399 4usize,
1400 concat!("Alignment of ", stringify!(ULRect))
1401 );
1402 assert_eq!(
1403 unsafe { ::std::ptr::addr_of!((*ptr).left) as usize - ptr as usize },
1404 0usize,
1405 concat!(
1406 "Offset of field: ",
1407 stringify!(ULRect),
1408 "::",
1409 stringify!(left)
1410 )
1411 );
1412 assert_eq!(
1413 unsafe { ::std::ptr::addr_of!((*ptr).top) as usize - ptr as usize },
1414 4usize,
1415 concat!(
1416 "Offset of field: ",
1417 stringify!(ULRect),
1418 "::",
1419 stringify!(top)
1420 )
1421 );
1422 assert_eq!(
1423 unsafe { ::std::ptr::addr_of!((*ptr).right) as usize - ptr as usize },
1424 8usize,
1425 concat!(
1426 "Offset of field: ",
1427 stringify!(ULRect),
1428 "::",
1429 stringify!(right)
1430 )
1431 );
1432 assert_eq!(
1433 unsafe { ::std::ptr::addr_of!((*ptr).bottom) as usize - ptr as usize },
1434 12usize,
1435 concat!(
1436 "Offset of field: ",
1437 stringify!(ULRect),
1438 "::",
1439 stringify!(bottom)
1440 )
1441 );
1442}
1443#[repr(C)]
1444#[derive(Debug, Default, Copy, Clone)]
1445pub struct ULIntRect {
1446 pub left: ::std::os::raw::c_int,
1447 pub top: ::std::os::raw::c_int,
1448 pub right: ::std::os::raw::c_int,
1449 pub bottom: ::std::os::raw::c_int,
1450}
1451#[test]
1452fn bindgen_test_layout_ULIntRect() {
1453 const UNINIT: ::std::mem::MaybeUninit<ULIntRect> = ::std::mem::MaybeUninit::uninit();
1454 let ptr = UNINIT.as_ptr();
1455 assert_eq!(
1456 ::std::mem::size_of::<ULIntRect>(),
1457 16usize,
1458 concat!("Size of: ", stringify!(ULIntRect))
1459 );
1460 assert_eq!(
1461 ::std::mem::align_of::<ULIntRect>(),
1462 4usize,
1463 concat!("Alignment of ", stringify!(ULIntRect))
1464 );
1465 assert_eq!(
1466 unsafe { ::std::ptr::addr_of!((*ptr).left) as usize - ptr as usize },
1467 0usize,
1468 concat!(
1469 "Offset of field: ",
1470 stringify!(ULIntRect),
1471 "::",
1472 stringify!(left)
1473 )
1474 );
1475 assert_eq!(
1476 unsafe { ::std::ptr::addr_of!((*ptr).top) as usize - ptr as usize },
1477 4usize,
1478 concat!(
1479 "Offset of field: ",
1480 stringify!(ULIntRect),
1481 "::",
1482 stringify!(top)
1483 )
1484 );
1485 assert_eq!(
1486 unsafe { ::std::ptr::addr_of!((*ptr).right) as usize - ptr as usize },
1487 8usize,
1488 concat!(
1489 "Offset of field: ",
1490 stringify!(ULIntRect),
1491 "::",
1492 stringify!(right)
1493 )
1494 );
1495 assert_eq!(
1496 unsafe { ::std::ptr::addr_of!((*ptr).bottom) as usize - ptr as usize },
1497 12usize,
1498 concat!(
1499 "Offset of field: ",
1500 stringify!(ULIntRect),
1501 "::",
1502 stringify!(bottom)
1503 )
1504 );
1505}
1506#[repr(C)]
1507#[derive(Debug, Copy, Clone)]
1508pub struct ULRenderTarget {
1509 pub is_empty: bool,
1510 pub width: ::std::os::raw::c_uint,
1511 pub height: ::std::os::raw::c_uint,
1512 pub texture_id: ::std::os::raw::c_uint,
1513 pub texture_width: ::std::os::raw::c_uint,
1514 pub texture_height: ::std::os::raw::c_uint,
1515 pub texture_format: ULBitmapFormat,
1516 pub uv_coords: ULRect,
1517 pub render_buffer_id: ::std::os::raw::c_uint,
1518}
1519#[test]
1520fn bindgen_test_layout_ULRenderTarget() {
1521 const UNINIT: ::std::mem::MaybeUninit<ULRenderTarget> = ::std::mem::MaybeUninit::uninit();
1522 let ptr = UNINIT.as_ptr();
1523 assert_eq!(
1524 ::std::mem::size_of::<ULRenderTarget>(),
1525 48usize,
1526 concat!("Size of: ", stringify!(ULRenderTarget))
1527 );
1528 assert_eq!(
1529 ::std::mem::align_of::<ULRenderTarget>(),
1530 4usize,
1531 concat!("Alignment of ", stringify!(ULRenderTarget))
1532 );
1533 assert_eq!(
1534 unsafe { ::std::ptr::addr_of!((*ptr).is_empty) as usize - ptr as usize },
1535 0usize,
1536 concat!(
1537 "Offset of field: ",
1538 stringify!(ULRenderTarget),
1539 "::",
1540 stringify!(is_empty)
1541 )
1542 );
1543 assert_eq!(
1544 unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize },
1545 4usize,
1546 concat!(
1547 "Offset of field: ",
1548 stringify!(ULRenderTarget),
1549 "::",
1550 stringify!(width)
1551 )
1552 );
1553 assert_eq!(
1554 unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize },
1555 8usize,
1556 concat!(
1557 "Offset of field: ",
1558 stringify!(ULRenderTarget),
1559 "::",
1560 stringify!(height)
1561 )
1562 );
1563 assert_eq!(
1564 unsafe { ::std::ptr::addr_of!((*ptr).texture_id) as usize - ptr as usize },
1565 12usize,
1566 concat!(
1567 "Offset of field: ",
1568 stringify!(ULRenderTarget),
1569 "::",
1570 stringify!(texture_id)
1571 )
1572 );
1573 assert_eq!(
1574 unsafe { ::std::ptr::addr_of!((*ptr).texture_width) as usize - ptr as usize },
1575 16usize,
1576 concat!(
1577 "Offset of field: ",
1578 stringify!(ULRenderTarget),
1579 "::",
1580 stringify!(texture_width)
1581 )
1582 );
1583 assert_eq!(
1584 unsafe { ::std::ptr::addr_of!((*ptr).texture_height) as usize - ptr as usize },
1585 20usize,
1586 concat!(
1587 "Offset of field: ",
1588 stringify!(ULRenderTarget),
1589 "::",
1590 stringify!(texture_height)
1591 )
1592 );
1593 assert_eq!(
1594 unsafe { ::std::ptr::addr_of!((*ptr).texture_format) as usize - ptr as usize },
1595 24usize,
1596 concat!(
1597 "Offset of field: ",
1598 stringify!(ULRenderTarget),
1599 "::",
1600 stringify!(texture_format)
1601 )
1602 );
1603 assert_eq!(
1604 unsafe { ::std::ptr::addr_of!((*ptr).uv_coords) as usize - ptr as usize },
1605 28usize,
1606 concat!(
1607 "Offset of field: ",
1608 stringify!(ULRenderTarget),
1609 "::",
1610 stringify!(uv_coords)
1611 )
1612 );
1613 assert_eq!(
1614 unsafe { ::std::ptr::addr_of!((*ptr).render_buffer_id) as usize - ptr as usize },
1615 44usize,
1616 concat!(
1617 "Offset of field: ",
1618 stringify!(ULRenderTarget),
1619 "::",
1620 stringify!(render_buffer_id)
1621 )
1622 );
1623}
1624impl Default for ULRenderTarget {
1625 fn default() -> Self {
1626 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1627 unsafe {
1628 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1629 s.assume_init()
1630 }
1631 }
1632}
1633extern "C" {
1634 #[doc = "\n Get the version string of the library in MAJOR.MINOR.PATCH format.\n"]
1635 pub fn ulVersionString() -> *const ::std::os::raw::c_char;
1636}
1637extern "C" {
1638 #[doc = "\n Get the numeric major version of the library.\n"]
1639 pub fn ulVersionMajor() -> ::std::os::raw::c_uint;
1640}
1641extern "C" {
1642 #[doc = "\n Get the numeric minor version of the library.\n"]
1643 pub fn ulVersionMinor() -> ::std::os::raw::c_uint;
1644}
1645extern "C" {
1646 #[doc = "\n Get the numeric patch version of the library.\n"]
1647 pub fn ulVersionPatch() -> ::std::os::raw::c_uint;
1648}
1649extern "C" {
1650 #[doc = "\n Get the full WebKit version string.\n"]
1651 pub fn ulWebKitVersionString() -> *const ::std::os::raw::c_char;
1652}
1653extern "C" {
1654 #[doc = "\n Create empty bitmap.\n"]
1655 pub fn ulCreateEmptyBitmap() -> ULBitmap;
1656}
1657extern "C" {
1658 #[doc = "\n Create bitmap with certain dimensions and pixel format.\n"]
1659 pub fn ulCreateBitmap(
1660 width: ::std::os::raw::c_uint,
1661 height: ::std::os::raw::c_uint,
1662 format: ULBitmapFormat,
1663 ) -> ULBitmap;
1664}
1665extern "C" {
1666 #[doc = "\n Create bitmap from existing pixel buffer. @see Bitmap for help using this function.\n"]
1667 pub fn ulCreateBitmapFromPixels(
1668 width: ::std::os::raw::c_uint,
1669 height: ::std::os::raw::c_uint,
1670 format: ULBitmapFormat,
1671 row_bytes: ::std::os::raw::c_uint,
1672 pixels: *const ::std::os::raw::c_void,
1673 size: usize,
1674 should_copy: bool,
1675 ) -> ULBitmap;
1676}
1677extern "C" {
1678 #[doc = "\n Create bitmap from copy.\n"]
1679 pub fn ulCreateBitmapFromCopy(existing_bitmap: ULBitmap) -> ULBitmap;
1680}
1681extern "C" {
1682 #[doc = "\n Destroy a bitmap (you should only destroy Bitmaps you have explicitly created via one of the\n creation functions above.\n"]
1683 pub fn ulDestroyBitmap(bitmap: ULBitmap);
1684}
1685extern "C" {
1686 #[doc = "\n Get the width in pixels.\n"]
1687 pub fn ulBitmapGetWidth(bitmap: ULBitmap) -> ::std::os::raw::c_uint;
1688}
1689extern "C" {
1690 #[doc = "\n Get the height in pixels.\n"]
1691 pub fn ulBitmapGetHeight(bitmap: ULBitmap) -> ::std::os::raw::c_uint;
1692}
1693extern "C" {
1694 #[doc = "\n Get the pixel format.\n"]
1695 pub fn ulBitmapGetFormat(bitmap: ULBitmap) -> ULBitmapFormat;
1696}
1697extern "C" {
1698 #[doc = "\n Get the bytes per pixel.\n"]
1699 pub fn ulBitmapGetBpp(bitmap: ULBitmap) -> ::std::os::raw::c_uint;
1700}
1701extern "C" {
1702 #[doc = "\n Get the number of bytes per row.\n"]
1703 pub fn ulBitmapGetRowBytes(bitmap: ULBitmap) -> ::std::os::raw::c_uint;
1704}
1705extern "C" {
1706 #[doc = "\n Get the size in bytes of the underlying pixel buffer.\n"]
1707 pub fn ulBitmapGetSize(bitmap: ULBitmap) -> usize;
1708}
1709extern "C" {
1710 #[doc = "\n Whether or not this bitmap owns its own pixel buffer.\n"]
1711 pub fn ulBitmapOwnsPixels(bitmap: ULBitmap) -> bool;
1712}
1713extern "C" {
1714 #[doc = "\n Lock pixels for reading/writing, returns pointer to pixel buffer.\n"]
1715 pub fn ulBitmapLockPixels(bitmap: ULBitmap) -> *mut ::std::os::raw::c_void;
1716}
1717extern "C" {
1718 #[doc = "\n Unlock pixels after locking.\n"]
1719 pub fn ulBitmapUnlockPixels(bitmap: ULBitmap);
1720}
1721extern "C" {
1722 #[doc = "\n Get raw pixel buffer-- you should only call this if Bitmap is already locked.\n"]
1723 pub fn ulBitmapRawPixels(bitmap: ULBitmap) -> *mut ::std::os::raw::c_void;
1724}
1725extern "C" {
1726 #[doc = "\n Whether or not this bitmap is empty.\n"]
1727 pub fn ulBitmapIsEmpty(bitmap: ULBitmap) -> bool;
1728}
1729extern "C" {
1730 #[doc = "\n Reset bitmap pixels to 0.\n"]
1731 pub fn ulBitmapErase(bitmap: ULBitmap);
1732}
1733extern "C" {
1734 #[doc = "\n Write bitmap to a PNG on disk.\n"]
1735 pub fn ulBitmapWritePNG(bitmap: ULBitmap, path: *const ::std::os::raw::c_char) -> bool;
1736}
1737extern "C" {
1738 #[doc = "\n This converts a BGRA bitmap to RGBA bitmap and vice-versa by swapping the red and blue channels.\n"]
1739 pub fn ulBitmapSwapRedBlueChannels(bitmap: ULBitmap);
1740}
1741pub type ulDestroyBufferCallback = ::std::option::Option<
1742 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void, data: *mut ::std::os::raw::c_void),
1743>;
1744extern "C" {
1745 #[doc = "\n Create a Buffer from existing, user-owned data without any copies. An optional, user-supplied\n callback will be called to deallocate data upon destruction.\n\n @param data A pointer to the data.\n\n @param size Size of the data in bytes.\n\n @param user_data Optional user data that will be passed to destruction_callback\n when the returned Buffer is destroyed.\n\n @param destruction_callback Optional callback that will be called upon destruction. Pass a\n null pointer if you don't want to be informed of destruction.\n"]
1746 pub fn ulCreateBuffer(
1747 data: *mut ::std::os::raw::c_void,
1748 size: usize,
1749 user_data: *mut ::std::os::raw::c_void,
1750 destruction_callback: ulDestroyBufferCallback,
1751 ) -> ULBuffer;
1752}
1753extern "C" {
1754 #[doc = "\n Create a Buffer from existing data, a deep copy of data will be made.\n"]
1755 pub fn ulCreateBufferFromCopy(data: *const ::std::os::raw::c_void, size: usize) -> ULBuffer;
1756}
1757extern "C" {
1758 #[doc = "\n Destroy buffer (you should destroy any buffers you explicitly Create).\n"]
1759 pub fn ulDestroyBuffer(buffer: ULBuffer);
1760}
1761extern "C" {
1762 #[doc = "\n Get a pointer to the raw byte data.\n"]
1763 pub fn ulBufferGetData(buffer: ULBuffer) -> *mut ::std::os::raw::c_void;
1764}
1765extern "C" {
1766 #[doc = "\n Get the size in bytes.\n"]
1767 pub fn ulBufferGetSize(buffer: ULBuffer) -> usize;
1768}
1769extern "C" {
1770 #[doc = "\n Get the user data associated with this Buffer, if any.\n"]
1771 pub fn ulBufferGetUserData(buffer: ULBuffer) -> *mut ::std::os::raw::c_void;
1772}
1773extern "C" {
1774 #[doc = "\n Check whether this Buffer owns its own data (Buffer was created via ulCreateBufferFromCopy).\n If this is false, Buffer will call the user-supplied destruction callback to deallocate data\n when this Buffer instance is destroyed.\n"]
1775 pub fn ulBufferOwnsData(buffer: ULBuffer) -> bool;
1776}
1777#[doc = "\n The callback invoked when the library wants to clear the system's clipboard.\n"]
1778pub type ULClipboardClearCallback = ::std::option::Option<unsafe extern "C" fn()>;
1779#[doc = "\n The callback invoked when the library wants to read from the system's clipboard.\n\n You should store the result (if any) in 'result'.\n"]
1780pub type ULClipboardReadPlainTextCallback =
1781 ::std::option::Option<unsafe extern "C" fn(result: ULString)>;
1782#[doc = "\n The callback invoked when the library wants to write to the system's clipboard.\n"]
1783pub type ULClipboardWritePlainTextCallback =
1784 ::std::option::Option<unsafe extern "C" fn(text: ULString)>;
1785#[repr(C)]
1786#[derive(Debug, Default, Copy, Clone)]
1787pub struct ULClipboard {
1788 pub clear: ULClipboardClearCallback,
1789 pub read_plain_text: ULClipboardReadPlainTextCallback,
1790 pub write_plain_text: ULClipboardWritePlainTextCallback,
1791}
1792#[test]
1793fn bindgen_test_layout_ULClipboard() {
1794 const UNINIT: ::std::mem::MaybeUninit<ULClipboard> = ::std::mem::MaybeUninit::uninit();
1795 let ptr = UNINIT.as_ptr();
1796 assert_eq!(
1797 ::std::mem::size_of::<ULClipboard>(),
1798 24usize,
1799 concat!("Size of: ", stringify!(ULClipboard))
1800 );
1801 assert_eq!(
1802 ::std::mem::align_of::<ULClipboard>(),
1803 8usize,
1804 concat!("Alignment of ", stringify!(ULClipboard))
1805 );
1806 assert_eq!(
1807 unsafe { ::std::ptr::addr_of!((*ptr).clear) as usize - ptr as usize },
1808 0usize,
1809 concat!(
1810 "Offset of field: ",
1811 stringify!(ULClipboard),
1812 "::",
1813 stringify!(clear)
1814 )
1815 );
1816 assert_eq!(
1817 unsafe { ::std::ptr::addr_of!((*ptr).read_plain_text) as usize - ptr as usize },
1818 8usize,
1819 concat!(
1820 "Offset of field: ",
1821 stringify!(ULClipboard),
1822 "::",
1823 stringify!(read_plain_text)
1824 )
1825 );
1826 assert_eq!(
1827 unsafe { ::std::ptr::addr_of!((*ptr).write_plain_text) as usize - ptr as usize },
1828 16usize,
1829 concat!(
1830 "Offset of field: ",
1831 stringify!(ULClipboard),
1832 "::",
1833 stringify!(write_plain_text)
1834 )
1835 );
1836}
1837extern "C" {
1838 #[doc = "\n Create config with default values (see <Ultralight/platform/Config.h>).\n"]
1839 pub fn ulCreateConfig() -> ULConfig;
1840}
1841extern "C" {
1842 #[doc = "\n Destroy config.\n"]
1843 pub fn ulDestroyConfig(config: ULConfig);
1844}
1845extern "C" {
1846 #[doc = "\n A writable OS file path to store persistent Session data in.\n\n This data may include cookies, cached network resources, indexed DB, etc.\n\n @note Files are only written to the path when using a persistent Session.\n"]
1847 pub fn ulConfigSetCachePath(config: ULConfig, cache_path: ULString);
1848}
1849extern "C" {
1850 #[doc = "\n The relative path to the resources folder (loaded via the FileSystem API).\n\n The library loads certain resources (SSL certs, ICU data, etc.) from the FileSystem API\n during runtime (eg, `file:///resources/cacert.pem`).\n\n You can customize the relative file path to the resources folder by modifying this setting.\n\n (Default = \"resources/\")\n"]
1851 pub fn ulConfigSetResourcePathPrefix(config: ULConfig, resource_path_prefix: ULString);
1852}
1853extern "C" {
1854 #[doc = "\n The winding order for front-facing triangles.\n\n @pre Only used when GPU rendering is enabled for the View.\n\n (Default = kFaceWinding_CounterClockwise)\n"]
1855 pub fn ulConfigSetFaceWinding(config: ULConfig, winding: ULFaceWinding);
1856}
1857extern "C" {
1858 #[doc = "\n The hinting algorithm to use when rendering fonts. (Default = kFontHinting_Normal)\n\n @see ULFontHinting\n"]
1859 pub fn ulConfigSetFontHinting(config: ULConfig, font_hinting: ULFontHinting);
1860}
1861extern "C" {
1862 #[doc = "\n The gamma to use when compositing font glyphs, change this value to adjust contrast (Adobe and\n Apple prefer 1.8, others may prefer 2.2). (Default = 1.8)\n"]
1863 pub fn ulConfigSetFontGamma(config: ULConfig, font_gamma: f64);
1864}
1865extern "C" {
1866 #[doc = "\n Global user-defined CSS string (included before any CSS on the page).\n\n You can use this to override default styles for various elements on the page.\n\n @note This is an actual string of CSS, not a file path.\n"]
1867 pub fn ulConfigSetUserStylesheet(config: ULConfig, css_string: ULString);
1868}
1869extern "C" {
1870 #[doc = "\n Whether or not to continuously repaint any Views, regardless if they are dirty.\n\n This is mainly used to diagnose painting/shader issues and profile performance.\n\n (Default = False)\n"]
1871 pub fn ulConfigSetForceRepaint(config: ULConfig, enabled: bool);
1872}
1873extern "C" {
1874 #[doc = "\n The delay (in seconds) between every tick of a CSS animation.\n\n (Default = 1.0 / 60.0)\n"]
1875 pub fn ulConfigSetAnimationTimerDelay(config: ULConfig, delay: f64);
1876}
1877extern "C" {
1878 #[doc = "\n The delay (in seconds) between every tick of a smooth scroll animation.\n\n (Default = 1.0 / 60.0)\n"]
1879 pub fn ulConfigSetScrollTimerDelay(config: ULConfig, delay: f64);
1880}
1881extern "C" {
1882 #[doc = "\n The delay (in seconds) between every call to the recycler.\n\n The library attempts to reclaim excess memory during calls to the internal recycler. You can\n change how often this is run by modifying this value.\n\n (Default = 4.0)\n"]
1883 pub fn ulConfigSetRecycleDelay(config: ULConfig, delay: f64);
1884}
1885extern "C" {
1886 #[doc = "\n The size of WebCore's memory cache in bytes.\n\n @note You should increase this if you anticipate handling pages with large resources, Safari\n typically uses 128+ MiB for its cache.\n\n (Default = 64 * 1024 * 1024)\n"]
1887 pub fn ulConfigSetMemoryCacheSize(config: ULConfig, size: ::std::os::raw::c_uint);
1888}
1889extern "C" {
1890 #[doc = "\n The number of pages to keep in the cache. (Default: 0, none)\n\n @note\n \\parblock\n\n Safari typically caches about 5 pages and maintains an on-disk cache to support typical\n web-browsing activities.\n\n If you increase this, you should probably increase the memory cache size as well.\n\n \\endparblock\n\n (Default = 0)\n"]
1891 pub fn ulConfigSetPageCacheSize(config: ULConfig, size: ::std::os::raw::c_uint);
1892}
1893extern "C" {
1894 #[doc = "\n The system's physical RAM size in bytes.\n\n JavaScriptCore tries to detect the system's physical RAM size to set reasonable allocation\n limits. Set this to anything other than 0 to override the detected value. Size is in bytes.\n\n This can be used to force JavaScriptCore to be more conservative with its allocation strategy\n (at the cost of some performance).\n"]
1895 pub fn ulConfigSetOverrideRAMSize(config: ULConfig, size: ::std::os::raw::c_uint);
1896}
1897extern "C" {
1898 #[doc = "\n The minimum size of large VM heaps in JavaScriptCore.\n\n Set this to a lower value to make these heaps start with a smaller initial value.\n\n (Default = 32 * 1024 * 1024)\n"]
1899 pub fn ulConfigSetMinLargeHeapSize(config: ULConfig, size: ::std::os::raw::c_uint);
1900}
1901extern "C" {
1902 #[doc = "\n The minimum size of small VM heaps in JavaScriptCore.\n\n Set this to a lower value to make these heaps start with a smaller initial value.\n\n (Default = 1 * 1024 * 1024)\n"]
1903 pub fn ulConfigSetMinSmallHeapSize(config: ULConfig, size: ::std::os::raw::c_uint);
1904}
1905extern "C" {
1906 #[doc = "\n The number of threads to use in the Renderer (for parallel painting on the CPU, etc.).\n\n You can set this to a certain number to limit the number of threads to spawn.\n\n @note\n \\parblock\n\n If this value is 0, the number of threads will be determined at runtime using the following\n formula:\n\n ```\n max(PhysicalProcessorCount() - 1, 1)\n ```\n\n \\endparblock\n"]
1907 pub fn ulConfigSetNumRendererThreads(
1908 config: ULConfig,
1909 num_renderer_threads: ::std::os::raw::c_uint,
1910 );
1911}
1912extern "C" {
1913 #[doc = "\n The max amount of time (in seconds) to allow repeating timers to run during each call to\n Renderer::Update.\n\n The library will attempt to throttle timers if this time budget is exceeded.\n\n (Default = 1.0 / 200.0)\n"]
1914 pub fn ulConfigSetMaxUpdateTime(config: ULConfig, max_update_time: f64);
1915}
1916extern "C" {
1917 #[doc = "\n The alignment (in bytes) of the BitmapSurface when using the CPU renderer.\n\n The underlying bitmap associated with each BitmapSurface will have row_bytes padded to reach\n this alignment.\n\n Aligning the bitmap helps improve performance when using the CPU renderer. Determining the\n proper value to use depends on the CPU architecture and max SIMD instruction set used.\n\n We generally target the 128-bit SSE2 instruction set across most PC platforms so '16' is a safe\n value to use.\n\n You can set this to '0' to perform no padding (row_bytes will always be width * 4) at a slight\n cost to performance.\n\n (Default = 16)\n"]
1918 pub fn ulConfigSetBitmapAlignment(config: ULConfig, bitmap_alignment: ::std::os::raw::c_uint);
1919}
1920#[doc = "\n The callback invoked when the FileSystem wants to check if a file path exists, return true if it\n exists.\n"]
1921pub type ULFileSystemFileExistsCallback =
1922 ::std::option::Option<unsafe extern "C" fn(path: ULString) -> bool>;
1923#[doc = "\n Get the mime-type of the file (eg \"text/html\").\n\n This is usually determined by analyzing the file extension.\n\n If a mime-type cannot be determined, you should return \"application/unknown\" for this value.\n\n The library will consume the result and call ulDestroyString() after this call returns.\n"]
1924pub type ULFileSystemGetFileMimeTypeCallback =
1925 ::std::option::Option<unsafe extern "C" fn(path: ULString) -> ULString>;
1926#[doc = "\n Get the charset / encoding of the file (eg \"utf-8\").\n\n This is only important for text-based files and is usually determined by analyzing the\n contents of the file.\n\n If a charset cannot be determined, it's usually safe to return \"utf-8\" for this value.\n\n The library will consume the result and call ulDestroyString() after this call returns.\n"]
1927pub type ULFileSystemGetFileCharsetCallback =
1928 ::std::option::Option<unsafe extern "C" fn(path: ULString) -> ULString>;
1929#[doc = "\n Open file for reading and map it to a Buffer.\n\n To minimize copies, you should map the requested file into memory and use ulCreateBuffer()\n to wrap the data pointer (unmapping should be performed in the destruction callback).\n\n If the file was unable to be opened, you should return NULL for this value.\n"]
1930pub type ULFileSystemOpenFileCallback =
1931 ::std::option::Option<unsafe extern "C" fn(path: ULString) -> ULBuffer>;
1932#[repr(C)]
1933#[derive(Debug, Default, Copy, Clone)]
1934pub struct ULFileSystem {
1935 pub file_exists: ULFileSystemFileExistsCallback,
1936 pub get_file_mime_type: ULFileSystemGetFileMimeTypeCallback,
1937 pub get_file_charset: ULFileSystemGetFileCharsetCallback,
1938 pub open_file: ULFileSystemOpenFileCallback,
1939}
1940#[test]
1941fn bindgen_test_layout_ULFileSystem() {
1942 const UNINIT: ::std::mem::MaybeUninit<ULFileSystem> = ::std::mem::MaybeUninit::uninit();
1943 let ptr = UNINIT.as_ptr();
1944 assert_eq!(
1945 ::std::mem::size_of::<ULFileSystem>(),
1946 32usize,
1947 concat!("Size of: ", stringify!(ULFileSystem))
1948 );
1949 assert_eq!(
1950 ::std::mem::align_of::<ULFileSystem>(),
1951 8usize,
1952 concat!("Alignment of ", stringify!(ULFileSystem))
1953 );
1954 assert_eq!(
1955 unsafe { ::std::ptr::addr_of!((*ptr).file_exists) as usize - ptr as usize },
1956 0usize,
1957 concat!(
1958 "Offset of field: ",
1959 stringify!(ULFileSystem),
1960 "::",
1961 stringify!(file_exists)
1962 )
1963 );
1964 assert_eq!(
1965 unsafe { ::std::ptr::addr_of!((*ptr).get_file_mime_type) as usize - ptr as usize },
1966 8usize,
1967 concat!(
1968 "Offset of field: ",
1969 stringify!(ULFileSystem),
1970 "::",
1971 stringify!(get_file_mime_type)
1972 )
1973 );
1974 assert_eq!(
1975 unsafe { ::std::ptr::addr_of!((*ptr).get_file_charset) as usize - ptr as usize },
1976 16usize,
1977 concat!(
1978 "Offset of field: ",
1979 stringify!(ULFileSystem),
1980 "::",
1981 stringify!(get_file_charset)
1982 )
1983 );
1984 assert_eq!(
1985 unsafe { ::std::ptr::addr_of!((*ptr).open_file) as usize - ptr as usize },
1986 24usize,
1987 concat!(
1988 "Offset of field: ",
1989 stringify!(ULFileSystem),
1990 "::",
1991 stringify!(open_file)
1992 )
1993 );
1994}
1995extern "C" {
1996 #[doc = "\n Create string from null-terminated ASCII C-string.\n"]
1997 pub fn ulCreateString(str_: *const ::std::os::raw::c_char) -> ULString;
1998}
1999extern "C" {
2000 #[doc = "\n Create string from UTF-8 buffer.\n"]
2001 pub fn ulCreateStringUTF8(str_: *const ::std::os::raw::c_char, len: usize) -> ULString;
2002}
2003extern "C" {
2004 #[doc = "\n Create string from UTF-16 buffer.\n"]
2005 pub fn ulCreateStringUTF16(str_: *mut ULChar16, len: usize) -> ULString;
2006}
2007extern "C" {
2008 #[doc = "\n Create string from copy of existing string.\n"]
2009 pub fn ulCreateStringFromCopy(str_: ULString) -> ULString;
2010}
2011extern "C" {
2012 #[doc = "\n Destroy string (you should destroy any strings you explicitly Create).\n"]
2013 pub fn ulDestroyString(str_: ULString);
2014}
2015extern "C" {
2016 #[doc = "\n Get native UTF-8 buffer data (always null-terminated).\n"]
2017 pub fn ulStringGetData(str_: ULString) -> *mut ::std::os::raw::c_char;
2018}
2019extern "C" {
2020 #[doc = "\n Get length (in bytes) of the UTF-8 buffer data, not including null terminator.\n"]
2021 pub fn ulStringGetLength(str_: ULString) -> usize;
2022}
2023extern "C" {
2024 #[doc = "\n Whether this string is empty or not.\n"]
2025 pub fn ulStringIsEmpty(str_: ULString) -> bool;
2026}
2027extern "C" {
2028 #[doc = "\n Replaces the contents of 'str' with the contents of 'new_str'\n"]
2029 pub fn ulStringAssignString(str_: ULString, new_str: ULString);
2030}
2031extern "C" {
2032 #[doc = "\n Replaces the contents of 'str' with the contents of a C-string.\n"]
2033 pub fn ulStringAssignCString(str_: ULString, c_str: *const ::std::os::raw::c_char);
2034}
2035extern "C" {
2036 #[doc = "\n Create a font file from an on-disk file path.\n\n @note The file path should already exist.\n"]
2037 pub fn ulFontFileCreateFromFilePath(file_path: ULString) -> ULFontFile;
2038}
2039extern "C" {
2040 #[doc = "\n Create a font file from an in-memory buffer.\n"]
2041 pub fn ulFontFileCreateFromBuffer(buffer: ULBuffer) -> ULFontFile;
2042}
2043extern "C" {
2044 #[doc = "\n Destroy font file\n"]
2045 pub fn ulDestroyFontFile(font_file: ULFontFile);
2046}
2047#[doc = "\n Fallback font family name. Will be used if all other fonts fail to load.\n\n @note This font should be guaranteed to exist (eg, ULFontLoader::load should not fail when\n when passed this font family name).\n\n @note The returned ULString instance will be consumed (ulDestroyString will be called on it).\n"]
2048pub type ULFontLoaderGetFallbackFont = ::std::option::Option<unsafe extern "C" fn() -> ULString>;
2049#[doc = "\n Fallback font family name that can render the specified characters. This is mainly used to\n support CJK (Chinese, Japanese, Korean) text display.\n\n @param characters One or more UTF-16 characters. This is almost always a single character.\n\n @param weight Font weight.\n\n @param italic Whether or not italic is requested.\n\n @return Should return a font family name that can render the text. The returned ULString\n instance will be consumed (ulDestroyString will be called on it).\n"]
2050pub type ULFontLoaderGetFallbackFontForCharacters = ::std::option::Option<
2051 unsafe extern "C" fn(
2052 characters: ULString,
2053 weight: ::std::os::raw::c_int,
2054 italic: bool,
2055 ) -> ULString,
2056>;
2057#[doc = "\n Get the actual font file data (TTF/OTF) for a given font description.\n\n @param family Font family name.\n\n @param weight Font weight.\n\n @param italic Whether or not italic is requested.\n\n @return A font file matching the given description (either an on-disk font filepath or an\n in-memory file buffer). You can return NULL here and the loader will fallback to\n another font.\n"]
2058pub type ULFontLoaderLoad = ::std::option::Option<
2059 unsafe extern "C" fn(
2060 family: ULString,
2061 weight: ::std::os::raw::c_int,
2062 italic: bool,
2063 ) -> ULFontFile,
2064>;
2065#[repr(C)]
2066#[derive(Debug, Default, Copy, Clone)]
2067pub struct ULFontLoader {
2068 pub get_fallback_font: ULFontLoaderGetFallbackFont,
2069 pub get_fallback_font_for_characters: ULFontLoaderGetFallbackFontForCharacters,
2070 pub load: ULFontLoaderLoad,
2071}
2072#[test]
2073fn bindgen_test_layout_ULFontLoader() {
2074 const UNINIT: ::std::mem::MaybeUninit<ULFontLoader> = ::std::mem::MaybeUninit::uninit();
2075 let ptr = UNINIT.as_ptr();
2076 assert_eq!(
2077 ::std::mem::size_of::<ULFontLoader>(),
2078 24usize,
2079 concat!("Size of: ", stringify!(ULFontLoader))
2080 );
2081 assert_eq!(
2082 ::std::mem::align_of::<ULFontLoader>(),
2083 8usize,
2084 concat!("Alignment of ", stringify!(ULFontLoader))
2085 );
2086 assert_eq!(
2087 unsafe { ::std::ptr::addr_of!((*ptr).get_fallback_font) as usize - ptr as usize },
2088 0usize,
2089 concat!(
2090 "Offset of field: ",
2091 stringify!(ULFontLoader),
2092 "::",
2093 stringify!(get_fallback_font)
2094 )
2095 );
2096 assert_eq!(
2097 unsafe {
2098 ::std::ptr::addr_of!((*ptr).get_fallback_font_for_characters) as usize - ptr as usize
2099 },
2100 8usize,
2101 concat!(
2102 "Offset of field: ",
2103 stringify!(ULFontLoader),
2104 "::",
2105 stringify!(get_fallback_font_for_characters)
2106 )
2107 );
2108 assert_eq!(
2109 unsafe { ::std::ptr::addr_of!((*ptr).load) as usize - ptr as usize },
2110 16usize,
2111 concat!(
2112 "Offset of field: ",
2113 stringify!(ULFontLoader),
2114 "::",
2115 stringify!(load)
2116 )
2117 );
2118}
2119extern "C" {
2120 #[doc = "\n Whether or not a ULRect is empty (all members equal to 0)\n"]
2121 pub fn ulRectIsEmpty(rect: ULRect) -> bool;
2122}
2123extern "C" {
2124 #[doc = "\n Create an empty ULRect (all members equal to 0)\n"]
2125 pub fn ulRectMakeEmpty() -> ULRect;
2126}
2127extern "C" {
2128 #[doc = "\n Whether or not a ULIntRect is empty (all members equal to 0)\n"]
2129 pub fn ulIntRectIsEmpty(rect: ULIntRect) -> bool;
2130}
2131extern "C" {
2132 #[doc = "\n Create an empty ULIntRect (all members equal to 0)\n"]
2133 pub fn ulIntRectMakeEmpty() -> ULIntRect;
2134}
2135#[doc = "\n Render buffer description.\n"]
2136#[repr(C)]
2137#[derive(Debug, Default, Copy, Clone)]
2138pub struct ULRenderBuffer {
2139 pub texture_id: ::std::os::raw::c_uint,
2140 pub width: ::std::os::raw::c_uint,
2141 pub height: ::std::os::raw::c_uint,
2142 pub has_stencil_buffer: bool,
2143 pub has_depth_buffer: bool,
2144}
2145#[test]
2146fn bindgen_test_layout_ULRenderBuffer() {
2147 const UNINIT: ::std::mem::MaybeUninit<ULRenderBuffer> = ::std::mem::MaybeUninit::uninit();
2148 let ptr = UNINIT.as_ptr();
2149 assert_eq!(
2150 ::std::mem::size_of::<ULRenderBuffer>(),
2151 16usize,
2152 concat!("Size of: ", stringify!(ULRenderBuffer))
2153 );
2154 assert_eq!(
2155 ::std::mem::align_of::<ULRenderBuffer>(),
2156 4usize,
2157 concat!("Alignment of ", stringify!(ULRenderBuffer))
2158 );
2159 assert_eq!(
2160 unsafe { ::std::ptr::addr_of!((*ptr).texture_id) as usize - ptr as usize },
2161 0usize,
2162 concat!(
2163 "Offset of field: ",
2164 stringify!(ULRenderBuffer),
2165 "::",
2166 stringify!(texture_id)
2167 )
2168 );
2169 assert_eq!(
2170 unsafe { ::std::ptr::addr_of!((*ptr).width) as usize - ptr as usize },
2171 4usize,
2172 concat!(
2173 "Offset of field: ",
2174 stringify!(ULRenderBuffer),
2175 "::",
2176 stringify!(width)
2177 )
2178 );
2179 assert_eq!(
2180 unsafe { ::std::ptr::addr_of!((*ptr).height) as usize - ptr as usize },
2181 8usize,
2182 concat!(
2183 "Offset of field: ",
2184 stringify!(ULRenderBuffer),
2185 "::",
2186 stringify!(height)
2187 )
2188 );
2189 assert_eq!(
2190 unsafe { ::std::ptr::addr_of!((*ptr).has_stencil_buffer) as usize - ptr as usize },
2191 12usize,
2192 concat!(
2193 "Offset of field: ",
2194 stringify!(ULRenderBuffer),
2195 "::",
2196 stringify!(has_stencil_buffer)
2197 )
2198 );
2199 assert_eq!(
2200 unsafe { ::std::ptr::addr_of!((*ptr).has_depth_buffer) as usize - ptr as usize },
2201 13usize,
2202 concat!(
2203 "Offset of field: ",
2204 stringify!(ULRenderBuffer),
2205 "::",
2206 stringify!(has_depth_buffer)
2207 )
2208 );
2209}
2210#[doc = "\n Vertex layout for path vertices.\n\n (this struct's members aligned on single-byte boundaries)\n"]
2211#[repr(C, packed)]
2212#[derive(Debug, Default, Copy, Clone)]
2213pub struct ULVertex_2f_4ub_2f {
2214 pub pos: [f32; 2usize],
2215 pub color: [::std::os::raw::c_uchar; 4usize],
2216 pub obj: [f32; 2usize],
2217}
2218#[test]
2219fn bindgen_test_layout_ULVertex_2f_4ub_2f() {
2220 const UNINIT: ::std::mem::MaybeUninit<ULVertex_2f_4ub_2f> = ::std::mem::MaybeUninit::uninit();
2221 let ptr = UNINIT.as_ptr();
2222 assert_eq!(
2223 ::std::mem::size_of::<ULVertex_2f_4ub_2f>(),
2224 20usize,
2225 concat!("Size of: ", stringify!(ULVertex_2f_4ub_2f))
2226 );
2227 assert_eq!(
2228 ::std::mem::align_of::<ULVertex_2f_4ub_2f>(),
2229 1usize,
2230 concat!("Alignment of ", stringify!(ULVertex_2f_4ub_2f))
2231 );
2232 assert_eq!(
2233 unsafe { ::std::ptr::addr_of!((*ptr).pos) as usize - ptr as usize },
2234 0usize,
2235 concat!(
2236 "Offset of field: ",
2237 stringify!(ULVertex_2f_4ub_2f),
2238 "::",
2239 stringify!(pos)
2240 )
2241 );
2242 assert_eq!(
2243 unsafe { ::std::ptr::addr_of!((*ptr).color) as usize - ptr as usize },
2244 8usize,
2245 concat!(
2246 "Offset of field: ",
2247 stringify!(ULVertex_2f_4ub_2f),
2248 "::",
2249 stringify!(color)
2250 )
2251 );
2252 assert_eq!(
2253 unsafe { ::std::ptr::addr_of!((*ptr).obj) as usize - ptr as usize },
2254 12usize,
2255 concat!(
2256 "Offset of field: ",
2257 stringify!(ULVertex_2f_4ub_2f),
2258 "::",
2259 stringify!(obj)
2260 )
2261 );
2262}
2263#[doc = "\n Vertex layout for quad vertices.\n\n (this struct's members aligned on single-byte boundaries)\n"]
2264#[repr(C, packed)]
2265#[derive(Debug, Default, Copy, Clone)]
2266pub struct ULVertex_2f_4ub_2f_2f_28f {
2267 pub pos: [f32; 2usize],
2268 pub color: [::std::os::raw::c_uchar; 4usize],
2269 pub tex: [f32; 2usize],
2270 pub obj: [f32; 2usize],
2271 pub data0: [f32; 4usize],
2272 pub data1: [f32; 4usize],
2273 pub data2: [f32; 4usize],
2274 pub data3: [f32; 4usize],
2275 pub data4: [f32; 4usize],
2276 pub data5: [f32; 4usize],
2277 pub data6: [f32; 4usize],
2278}
2279#[test]
2280fn bindgen_test_layout_ULVertex_2f_4ub_2f_2f_28f() {
2281 const UNINIT: ::std::mem::MaybeUninit<ULVertex_2f_4ub_2f_2f_28f> =
2282 ::std::mem::MaybeUninit::uninit();
2283 let ptr = UNINIT.as_ptr();
2284 assert_eq!(
2285 ::std::mem::size_of::<ULVertex_2f_4ub_2f_2f_28f>(),
2286 140usize,
2287 concat!("Size of: ", stringify!(ULVertex_2f_4ub_2f_2f_28f))
2288 );
2289 assert_eq!(
2290 ::std::mem::align_of::<ULVertex_2f_4ub_2f_2f_28f>(),
2291 1usize,
2292 concat!("Alignment of ", stringify!(ULVertex_2f_4ub_2f_2f_28f))
2293 );
2294 assert_eq!(
2295 unsafe { ::std::ptr::addr_of!((*ptr).pos) as usize - ptr as usize },
2296 0usize,
2297 concat!(
2298 "Offset of field: ",
2299 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2300 "::",
2301 stringify!(pos)
2302 )
2303 );
2304 assert_eq!(
2305 unsafe { ::std::ptr::addr_of!((*ptr).color) as usize - ptr as usize },
2306 8usize,
2307 concat!(
2308 "Offset of field: ",
2309 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2310 "::",
2311 stringify!(color)
2312 )
2313 );
2314 assert_eq!(
2315 unsafe { ::std::ptr::addr_of!((*ptr).tex) as usize - ptr as usize },
2316 12usize,
2317 concat!(
2318 "Offset of field: ",
2319 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2320 "::",
2321 stringify!(tex)
2322 )
2323 );
2324 assert_eq!(
2325 unsafe { ::std::ptr::addr_of!((*ptr).obj) as usize - ptr as usize },
2326 20usize,
2327 concat!(
2328 "Offset of field: ",
2329 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2330 "::",
2331 stringify!(obj)
2332 )
2333 );
2334 assert_eq!(
2335 unsafe { ::std::ptr::addr_of!((*ptr).data0) as usize - ptr as usize },
2336 28usize,
2337 concat!(
2338 "Offset of field: ",
2339 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2340 "::",
2341 stringify!(data0)
2342 )
2343 );
2344 assert_eq!(
2345 unsafe { ::std::ptr::addr_of!((*ptr).data1) as usize - ptr as usize },
2346 44usize,
2347 concat!(
2348 "Offset of field: ",
2349 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2350 "::",
2351 stringify!(data1)
2352 )
2353 );
2354 assert_eq!(
2355 unsafe { ::std::ptr::addr_of!((*ptr).data2) as usize - ptr as usize },
2356 60usize,
2357 concat!(
2358 "Offset of field: ",
2359 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2360 "::",
2361 stringify!(data2)
2362 )
2363 );
2364 assert_eq!(
2365 unsafe { ::std::ptr::addr_of!((*ptr).data3) as usize - ptr as usize },
2366 76usize,
2367 concat!(
2368 "Offset of field: ",
2369 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2370 "::",
2371 stringify!(data3)
2372 )
2373 );
2374 assert_eq!(
2375 unsafe { ::std::ptr::addr_of!((*ptr).data4) as usize - ptr as usize },
2376 92usize,
2377 concat!(
2378 "Offset of field: ",
2379 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2380 "::",
2381 stringify!(data4)
2382 )
2383 );
2384 assert_eq!(
2385 unsafe { ::std::ptr::addr_of!((*ptr).data5) as usize - ptr as usize },
2386 108usize,
2387 concat!(
2388 "Offset of field: ",
2389 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2390 "::",
2391 stringify!(data5)
2392 )
2393 );
2394 assert_eq!(
2395 unsafe { ::std::ptr::addr_of!((*ptr).data6) as usize - ptr as usize },
2396 124usize,
2397 concat!(
2398 "Offset of field: ",
2399 stringify!(ULVertex_2f_4ub_2f_2f_28f),
2400 "::",
2401 stringify!(data6)
2402 )
2403 );
2404}
2405pub const ULVertexBufferFormat_kVertexBufferFormat_2f_4ub_2f: ULVertexBufferFormat = 0;
2406pub const ULVertexBufferFormat_kVertexBufferFormat_2f_4ub_2f_2f_28f: ULVertexBufferFormat = 1;
2407#[doc = "\n Vertex formats.\n"]
2408pub type ULVertexBufferFormat = ::std::os::raw::c_uint;
2409#[doc = "\n Vertex buffer data.\n"]
2410#[repr(C)]
2411#[derive(Debug, Copy, Clone)]
2412pub struct ULVertexBuffer {
2413 pub format: ULVertexBufferFormat,
2414 pub size: ::std::os::raw::c_uint,
2415 pub data: *mut ::std::os::raw::c_uchar,
2416}
2417#[test]
2418fn bindgen_test_layout_ULVertexBuffer() {
2419 const UNINIT: ::std::mem::MaybeUninit<ULVertexBuffer> = ::std::mem::MaybeUninit::uninit();
2420 let ptr = UNINIT.as_ptr();
2421 assert_eq!(
2422 ::std::mem::size_of::<ULVertexBuffer>(),
2423 16usize,
2424 concat!("Size of: ", stringify!(ULVertexBuffer))
2425 );
2426 assert_eq!(
2427 ::std::mem::align_of::<ULVertexBuffer>(),
2428 8usize,
2429 concat!("Alignment of ", stringify!(ULVertexBuffer))
2430 );
2431 assert_eq!(
2432 unsafe { ::std::ptr::addr_of!((*ptr).format) as usize - ptr as usize },
2433 0usize,
2434 concat!(
2435 "Offset of field: ",
2436 stringify!(ULVertexBuffer),
2437 "::",
2438 stringify!(format)
2439 )
2440 );
2441 assert_eq!(
2442 unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
2443 4usize,
2444 concat!(
2445 "Offset of field: ",
2446 stringify!(ULVertexBuffer),
2447 "::",
2448 stringify!(size)
2449 )
2450 );
2451 assert_eq!(
2452 unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
2453 8usize,
2454 concat!(
2455 "Offset of field: ",
2456 stringify!(ULVertexBuffer),
2457 "::",
2458 stringify!(data)
2459 )
2460 );
2461}
2462impl Default for ULVertexBuffer {
2463 fn default() -> Self {
2464 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2465 unsafe {
2466 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2467 s.assume_init()
2468 }
2469 }
2470}
2471#[doc = "\n Vertex index type.\n"]
2472pub type ULIndexType = ::std::os::raw::c_uint;
2473#[doc = "\n Vertex index buffer data.\n"]
2474#[repr(C)]
2475#[derive(Debug, Copy, Clone)]
2476pub struct ULIndexBuffer {
2477 pub size: ::std::os::raw::c_uint,
2478 pub data: *mut ::std::os::raw::c_uchar,
2479}
2480#[test]
2481fn bindgen_test_layout_ULIndexBuffer() {
2482 const UNINIT: ::std::mem::MaybeUninit<ULIndexBuffer> = ::std::mem::MaybeUninit::uninit();
2483 let ptr = UNINIT.as_ptr();
2484 assert_eq!(
2485 ::std::mem::size_of::<ULIndexBuffer>(),
2486 16usize,
2487 concat!("Size of: ", stringify!(ULIndexBuffer))
2488 );
2489 assert_eq!(
2490 ::std::mem::align_of::<ULIndexBuffer>(),
2491 8usize,
2492 concat!("Alignment of ", stringify!(ULIndexBuffer))
2493 );
2494 assert_eq!(
2495 unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
2496 0usize,
2497 concat!(
2498 "Offset of field: ",
2499 stringify!(ULIndexBuffer),
2500 "::",
2501 stringify!(size)
2502 )
2503 );
2504 assert_eq!(
2505 unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
2506 8usize,
2507 concat!(
2508 "Offset of field: ",
2509 stringify!(ULIndexBuffer),
2510 "::",
2511 stringify!(data)
2512 )
2513 );
2514}
2515impl Default for ULIndexBuffer {
2516 fn default() -> Self {
2517 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2518 unsafe {
2519 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2520 s.assume_init()
2521 }
2522 }
2523}
2524pub const ULShaderType_kShaderType_Fill: ULShaderType = 0;
2525pub const ULShaderType_kShaderType_FillPath: ULShaderType = 1;
2526#[doc = "\n Shader types, used with ULGPUState::shader_type\n\n Each of these correspond to a vertex/pixel shader pair. You can find stock shader code for these\n in the `shaders` folder of the AppCore repo.\n"]
2527pub type ULShaderType = ::std::os::raw::c_uint;
2528#[doc = "\n Raw 4x4 matrix as an array of floats\n"]
2529#[repr(C)]
2530#[derive(Debug, Default, Copy, Clone)]
2531pub struct ULMatrix4x4 {
2532 pub data: [f32; 16usize],
2533}
2534#[test]
2535fn bindgen_test_layout_ULMatrix4x4() {
2536 const UNINIT: ::std::mem::MaybeUninit<ULMatrix4x4> = ::std::mem::MaybeUninit::uninit();
2537 let ptr = UNINIT.as_ptr();
2538 assert_eq!(
2539 ::std::mem::size_of::<ULMatrix4x4>(),
2540 64usize,
2541 concat!("Size of: ", stringify!(ULMatrix4x4))
2542 );
2543 assert_eq!(
2544 ::std::mem::align_of::<ULMatrix4x4>(),
2545 4usize,
2546 concat!("Alignment of ", stringify!(ULMatrix4x4))
2547 );
2548 assert_eq!(
2549 unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
2550 0usize,
2551 concat!(
2552 "Offset of field: ",
2553 stringify!(ULMatrix4x4),
2554 "::",
2555 stringify!(data)
2556 )
2557 );
2558}
2559#[doc = "\n 4-component float vector\n"]
2560#[repr(C)]
2561#[derive(Debug, Default, Copy, Clone)]
2562pub struct ULvec4 {
2563 pub value: [f32; 4usize],
2564}
2565#[test]
2566fn bindgen_test_layout_ULvec4() {
2567 const UNINIT: ::std::mem::MaybeUninit<ULvec4> = ::std::mem::MaybeUninit::uninit();
2568 let ptr = UNINIT.as_ptr();
2569 assert_eq!(
2570 ::std::mem::size_of::<ULvec4>(),
2571 16usize,
2572 concat!("Size of: ", stringify!(ULvec4))
2573 );
2574 assert_eq!(
2575 ::std::mem::align_of::<ULvec4>(),
2576 4usize,
2577 concat!("Alignment of ", stringify!(ULvec4))
2578 );
2579 assert_eq!(
2580 unsafe { ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize },
2581 0usize,
2582 concat!(
2583 "Offset of field: ",
2584 stringify!(ULvec4),
2585 "::",
2586 stringify!(value)
2587 )
2588 );
2589}
2590#[doc = "\n GPU State description.\n"]
2591#[repr(C)]
2592#[derive(Debug, Default, Copy, Clone)]
2593pub struct ULGPUState {
2594 #[doc = " Viewport width in pixels"]
2595 pub viewport_width: ::std::os::raw::c_uint,
2596 #[doc = " Viewport height in pixels"]
2597 pub viewport_height: ::std::os::raw::c_uint,
2598 #[doc = " Transform matrix-- you should multiply this with the screen-space orthographic projection\n matrix then pass to the vertex shader."]
2599 pub transform: ULMatrix4x4,
2600 #[doc = " Whether or not we should enable texturing for the current draw command."]
2601 pub enable_texturing: bool,
2602 #[doc = " Whether or not we should enable blending for the current draw command. If blending is\n disabled, any drawn pixels should overwrite existing. Mainly used so we can modify alpha\n values of the RenderBuffer during scissored clears."]
2603 pub enable_blend: bool,
2604 #[doc = " The vertex/pixel shader program pair to use for the current draw command. You should cast this\n to ShaderType to get the corresponding enum."]
2605 pub shader_type: ::std::os::raw::c_uchar,
2606 #[doc = " The render buffer to use for the current draw command."]
2607 pub render_buffer_id: ::std::os::raw::c_uint,
2608 #[doc = " The texture id to bind to slot #1. (Will be 0 if none)"]
2609 pub texture_1_id: ::std::os::raw::c_uint,
2610 #[doc = " The texture id to bind to slot #2. (Will be 0 if none)"]
2611 pub texture_2_id: ::std::os::raw::c_uint,
2612 #[doc = " The texture id to bind to slot #3. (Will be 0 if none)"]
2613 pub texture_3_id: ::std::os::raw::c_uint,
2614 #[doc = " The following four members are passed to the pixel shader via uniforms."]
2615 pub uniform_scalar: [f32; 8usize],
2616 pub uniform_vector: [ULvec4; 8usize],
2617 pub clip_size: ::std::os::raw::c_uchar,
2618 pub clip: [ULMatrix4x4; 8usize],
2619 #[doc = " Whether or not scissor testing should be used for the current draw\n command."]
2620 pub enable_scissor: bool,
2621 #[doc = " The scissor rect to use for scissor testing (units in pixels)"]
2622 pub scissor_rect: ULIntRect,
2623}
2624#[test]
2625fn bindgen_test_layout_ULGPUState() {
2626 const UNINIT: ::std::mem::MaybeUninit<ULGPUState> = ::std::mem::MaybeUninit::uninit();
2627 let ptr = UNINIT.as_ptr();
2628 assert_eq!(
2629 ::std::mem::size_of::<ULGPUState>(),
2630 788usize,
2631 concat!("Size of: ", stringify!(ULGPUState))
2632 );
2633 assert_eq!(
2634 ::std::mem::align_of::<ULGPUState>(),
2635 4usize,
2636 concat!("Alignment of ", stringify!(ULGPUState))
2637 );
2638 assert_eq!(
2639 unsafe { ::std::ptr::addr_of!((*ptr).viewport_width) as usize - ptr as usize },
2640 0usize,
2641 concat!(
2642 "Offset of field: ",
2643 stringify!(ULGPUState),
2644 "::",
2645 stringify!(viewport_width)
2646 )
2647 );
2648 assert_eq!(
2649 unsafe { ::std::ptr::addr_of!((*ptr).viewport_height) as usize - ptr as usize },
2650 4usize,
2651 concat!(
2652 "Offset of field: ",
2653 stringify!(ULGPUState),
2654 "::",
2655 stringify!(viewport_height)
2656 )
2657 );
2658 assert_eq!(
2659 unsafe { ::std::ptr::addr_of!((*ptr).transform) as usize - ptr as usize },
2660 8usize,
2661 concat!(
2662 "Offset of field: ",
2663 stringify!(ULGPUState),
2664 "::",
2665 stringify!(transform)
2666 )
2667 );
2668 assert_eq!(
2669 unsafe { ::std::ptr::addr_of!((*ptr).enable_texturing) as usize - ptr as usize },
2670 72usize,
2671 concat!(
2672 "Offset of field: ",
2673 stringify!(ULGPUState),
2674 "::",
2675 stringify!(enable_texturing)
2676 )
2677 );
2678 assert_eq!(
2679 unsafe { ::std::ptr::addr_of!((*ptr).enable_blend) as usize - ptr as usize },
2680 73usize,
2681 concat!(
2682 "Offset of field: ",
2683 stringify!(ULGPUState),
2684 "::",
2685 stringify!(enable_blend)
2686 )
2687 );
2688 assert_eq!(
2689 unsafe { ::std::ptr::addr_of!((*ptr).shader_type) as usize - ptr as usize },
2690 74usize,
2691 concat!(
2692 "Offset of field: ",
2693 stringify!(ULGPUState),
2694 "::",
2695 stringify!(shader_type)
2696 )
2697 );
2698 assert_eq!(
2699 unsafe { ::std::ptr::addr_of!((*ptr).render_buffer_id) as usize - ptr as usize },
2700 76usize,
2701 concat!(
2702 "Offset of field: ",
2703 stringify!(ULGPUState),
2704 "::",
2705 stringify!(render_buffer_id)
2706 )
2707 );
2708 assert_eq!(
2709 unsafe { ::std::ptr::addr_of!((*ptr).texture_1_id) as usize - ptr as usize },
2710 80usize,
2711 concat!(
2712 "Offset of field: ",
2713 stringify!(ULGPUState),
2714 "::",
2715 stringify!(texture_1_id)
2716 )
2717 );
2718 assert_eq!(
2719 unsafe { ::std::ptr::addr_of!((*ptr).texture_2_id) as usize - ptr as usize },
2720 84usize,
2721 concat!(
2722 "Offset of field: ",
2723 stringify!(ULGPUState),
2724 "::",
2725 stringify!(texture_2_id)
2726 )
2727 );
2728 assert_eq!(
2729 unsafe { ::std::ptr::addr_of!((*ptr).texture_3_id) as usize - ptr as usize },
2730 88usize,
2731 concat!(
2732 "Offset of field: ",
2733 stringify!(ULGPUState),
2734 "::",
2735 stringify!(texture_3_id)
2736 )
2737 );
2738 assert_eq!(
2739 unsafe { ::std::ptr::addr_of!((*ptr).uniform_scalar) as usize - ptr as usize },
2740 92usize,
2741 concat!(
2742 "Offset of field: ",
2743 stringify!(ULGPUState),
2744 "::",
2745 stringify!(uniform_scalar)
2746 )
2747 );
2748 assert_eq!(
2749 unsafe { ::std::ptr::addr_of!((*ptr).uniform_vector) as usize - ptr as usize },
2750 124usize,
2751 concat!(
2752 "Offset of field: ",
2753 stringify!(ULGPUState),
2754 "::",
2755 stringify!(uniform_vector)
2756 )
2757 );
2758 assert_eq!(
2759 unsafe { ::std::ptr::addr_of!((*ptr).clip_size) as usize - ptr as usize },
2760 252usize,
2761 concat!(
2762 "Offset of field: ",
2763 stringify!(ULGPUState),
2764 "::",
2765 stringify!(clip_size)
2766 )
2767 );
2768 assert_eq!(
2769 unsafe { ::std::ptr::addr_of!((*ptr).clip) as usize - ptr as usize },
2770 256usize,
2771 concat!(
2772 "Offset of field: ",
2773 stringify!(ULGPUState),
2774 "::",
2775 stringify!(clip)
2776 )
2777 );
2778 assert_eq!(
2779 unsafe { ::std::ptr::addr_of!((*ptr).enable_scissor) as usize - ptr as usize },
2780 768usize,
2781 concat!(
2782 "Offset of field: ",
2783 stringify!(ULGPUState),
2784 "::",
2785 stringify!(enable_scissor)
2786 )
2787 );
2788 assert_eq!(
2789 unsafe { ::std::ptr::addr_of!((*ptr).scissor_rect) as usize - ptr as usize },
2790 772usize,
2791 concat!(
2792 "Offset of field: ",
2793 stringify!(ULGPUState),
2794 "::",
2795 stringify!(scissor_rect)
2796 )
2797 );
2798}
2799pub const ULCommandType_kCommandType_ClearRenderBuffer: ULCommandType = 0;
2800pub const ULCommandType_kCommandType_DrawGeometry: ULCommandType = 1;
2801#[doc = "\n Command types, used with ULCommand::command_type\n"]
2802pub type ULCommandType = ::std::os::raw::c_uint;
2803#[doc = "\n Command description.\n"]
2804#[repr(C)]
2805#[derive(Debug, Default, Copy, Clone)]
2806pub struct ULCommand {
2807 pub command_type: ::std::os::raw::c_uchar,
2808 pub gpu_state: ULGPUState,
2809 #[doc = " The following members are only used with kCommandType_DrawGeometry"]
2810 pub geometry_id: ::std::os::raw::c_uint,
2811 pub indices_count: ::std::os::raw::c_uint,
2812 pub indices_offset: ::std::os::raw::c_uint,
2813}
2814#[test]
2815fn bindgen_test_layout_ULCommand() {
2816 const UNINIT: ::std::mem::MaybeUninit<ULCommand> = ::std::mem::MaybeUninit::uninit();
2817 let ptr = UNINIT.as_ptr();
2818 assert_eq!(
2819 ::std::mem::size_of::<ULCommand>(),
2820 804usize,
2821 concat!("Size of: ", stringify!(ULCommand))
2822 );
2823 assert_eq!(
2824 ::std::mem::align_of::<ULCommand>(),
2825 4usize,
2826 concat!("Alignment of ", stringify!(ULCommand))
2827 );
2828 assert_eq!(
2829 unsafe { ::std::ptr::addr_of!((*ptr).command_type) as usize - ptr as usize },
2830 0usize,
2831 concat!(
2832 "Offset of field: ",
2833 stringify!(ULCommand),
2834 "::",
2835 stringify!(command_type)
2836 )
2837 );
2838 assert_eq!(
2839 unsafe { ::std::ptr::addr_of!((*ptr).gpu_state) as usize - ptr as usize },
2840 4usize,
2841 concat!(
2842 "Offset of field: ",
2843 stringify!(ULCommand),
2844 "::",
2845 stringify!(gpu_state)
2846 )
2847 );
2848 assert_eq!(
2849 unsafe { ::std::ptr::addr_of!((*ptr).geometry_id) as usize - ptr as usize },
2850 792usize,
2851 concat!(
2852 "Offset of field: ",
2853 stringify!(ULCommand),
2854 "::",
2855 stringify!(geometry_id)
2856 )
2857 );
2858 assert_eq!(
2859 unsafe { ::std::ptr::addr_of!((*ptr).indices_count) as usize - ptr as usize },
2860 796usize,
2861 concat!(
2862 "Offset of field: ",
2863 stringify!(ULCommand),
2864 "::",
2865 stringify!(indices_count)
2866 )
2867 );
2868 assert_eq!(
2869 unsafe { ::std::ptr::addr_of!((*ptr).indices_offset) as usize - ptr as usize },
2870 800usize,
2871 concat!(
2872 "Offset of field: ",
2873 stringify!(ULCommand),
2874 "::",
2875 stringify!(indices_offset)
2876 )
2877 );
2878}
2879#[doc = "\n Command list, @see ULGPUDriverUpdateCommandList"]
2880#[repr(C)]
2881#[derive(Debug, Copy, Clone)]
2882pub struct ULCommandList {
2883 pub size: ::std::os::raw::c_uint,
2884 pub commands: *mut ULCommand,
2885}
2886#[test]
2887fn bindgen_test_layout_ULCommandList() {
2888 const UNINIT: ::std::mem::MaybeUninit<ULCommandList> = ::std::mem::MaybeUninit::uninit();
2889 let ptr = UNINIT.as_ptr();
2890 assert_eq!(
2891 ::std::mem::size_of::<ULCommandList>(),
2892 16usize,
2893 concat!("Size of: ", stringify!(ULCommandList))
2894 );
2895 assert_eq!(
2896 ::std::mem::align_of::<ULCommandList>(),
2897 8usize,
2898 concat!("Alignment of ", stringify!(ULCommandList))
2899 );
2900 assert_eq!(
2901 unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
2902 0usize,
2903 concat!(
2904 "Offset of field: ",
2905 stringify!(ULCommandList),
2906 "::",
2907 stringify!(size)
2908 )
2909 );
2910 assert_eq!(
2911 unsafe { ::std::ptr::addr_of!((*ptr).commands) as usize - ptr as usize },
2912 8usize,
2913 concat!(
2914 "Offset of field: ",
2915 stringify!(ULCommandList),
2916 "::",
2917 stringify!(commands)
2918 )
2919 );
2920}
2921impl Default for ULCommandList {
2922 fn default() -> Self {
2923 let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
2924 unsafe {
2925 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
2926 s.assume_init()
2927 }
2928 }
2929}
2930#[doc = "\n The callback invoked when the GPUDriver will begin dispatching commands (such as CreateTexture\n and UpdateCommandList) during the current call to ulRender().\n"]
2931pub type ULGPUDriverBeginSynchronizeCallback = ::std::option::Option<unsafe extern "C" fn()>;
2932#[doc = "\n The callback invoked when the GPUDriver has finished dispatching commands during the current\n call to ulRender().\n"]
2933pub type ULGPUDriverEndSynchronizeCallback = ::std::option::Option<unsafe extern "C" fn()>;
2934#[doc = "\n The callback invoked when the GPUDriver wants to get the next available texture ID.\n"]
2935pub type ULGPUDriverNextTextureIdCallback =
2936 ::std::option::Option<unsafe extern "C" fn() -> ::std::os::raw::c_uint>;
2937#[doc = "\n The callback invoked when the GPUDriver wants to create a texture with a\n certain ID and optional bitmap.\n\n @note: If the Bitmap is empty (ulBitmapIsEmpty), then a RTT Texture should be created\n instead. This will be used as a backing texture for a new RenderBuffer.\n"]
2938pub type ULGPUDriverCreateTextureCallback = ::std::option::Option<
2939 unsafe extern "C" fn(texture_id: ::std::os::raw::c_uint, bitmap: ULBitmap),
2940>;
2941#[doc = "\n The callback invoked when the GPUDriver wants to update an existing non-RTT texture with new\n bitmap data.\n"]
2942pub type ULGPUDriverUpdateTextureCallback = ::std::option::Option<
2943 unsafe extern "C" fn(texture_id: ::std::os::raw::c_uint, bitmap: ULBitmap),
2944>;
2945#[doc = "\n The callback invoked when the GPUDriver wants to destroy a texture.\n"]
2946pub type ULGPUDriverDestroyTextureCallback =
2947 ::std::option::Option<unsafe extern "C" fn(texture_id: ::std::os::raw::c_uint)>;
2948#[doc = "\n The callback invoked when the GPUDriver wants to generate the next available render buffer ID.\n"]
2949pub type ULGPUDriverNextRenderBufferIdCallback =
2950 ::std::option::Option<unsafe extern "C" fn() -> ::std::os::raw::c_uint>;
2951#[doc = "\n The callback invoked when the GPUDriver wants to create a render buffer with certain ID and\n buffer description.\n"]
2952pub type ULGPUDriverCreateRenderBufferCallback = ::std::option::Option<
2953 unsafe extern "C" fn(render_buffer_id: ::std::os::raw::c_uint, buffer: ULRenderBuffer),
2954>;
2955#[doc = "\n The callback invoked when the GPUDriver wants to destroy a render buffer\n"]
2956pub type ULGPUDriverDestroyRenderBufferCallback =
2957 ::std::option::Option<unsafe extern "C" fn(render_buffer_id: ::std::os::raw::c_uint)>;
2958#[doc = "\n The callback invoked when the GPUDriver wants to generate the next available geometry ID.\n"]
2959pub type ULGPUDriverNextGeometryIdCallback =
2960 ::std::option::Option<unsafe extern "C" fn() -> ::std::os::raw::c_uint>;
2961#[doc = "\n The callback invoked when the GPUDriver wants to create geometry with certain ID and\n vertex/index data.\n"]
2962pub type ULGPUDriverCreateGeometryCallback = ::std::option::Option<
2963 unsafe extern "C" fn(
2964 geometry_id: ::std::os::raw::c_uint,
2965 vertices: ULVertexBuffer,
2966 indices: ULIndexBuffer,
2967 ),
2968>;
2969#[doc = "\n The callback invoked when the GPUDriver wants to update existing geometry with new vertex/index\n data.\n"]
2970pub type ULGPUDriverUpdateGeometryCallback = ::std::option::Option<
2971 unsafe extern "C" fn(
2972 geometry_id: ::std::os::raw::c_uint,
2973 vertices: ULVertexBuffer,
2974 indices: ULIndexBuffer,
2975 ),
2976>;
2977#[doc = "\n The callback invoked when the GPUDriver wants to destroy geometry.\n"]
2978pub type ULGPUDriverDestroyGeometryCallback =
2979 ::std::option::Option<unsafe extern "C" fn(geometry_id: ::std::os::raw::c_uint)>;
2980#[doc = "\n The callback invoked when the GPUDriver wants to update the command list (you should copy the\n commands to your own structure).\n"]
2981pub type ULGPUDriverUpdateCommandListCallback =
2982 ::std::option::Option<unsafe extern "C" fn(list: ULCommandList)>;
2983#[repr(C)]
2984#[derive(Debug, Default, Copy, Clone)]
2985pub struct ULGPUDriver {
2986 pub begin_synchronize: ULGPUDriverBeginSynchronizeCallback,
2987 pub end_synchronize: ULGPUDriverEndSynchronizeCallback,
2988 pub next_texture_id: ULGPUDriverNextTextureIdCallback,
2989 pub create_texture: ULGPUDriverCreateTextureCallback,
2990 pub update_texture: ULGPUDriverUpdateTextureCallback,
2991 pub destroy_texture: ULGPUDriverDestroyTextureCallback,
2992 pub next_render_buffer_id: ULGPUDriverNextRenderBufferIdCallback,
2993 pub create_render_buffer: ULGPUDriverCreateRenderBufferCallback,
2994 pub destroy_render_buffer: ULGPUDriverDestroyRenderBufferCallback,
2995 pub next_geometry_id: ULGPUDriverNextGeometryIdCallback,
2996 pub create_geometry: ULGPUDriverCreateGeometryCallback,
2997 pub update_geometry: ULGPUDriverUpdateGeometryCallback,
2998 pub destroy_geometry: ULGPUDriverDestroyGeometryCallback,
2999 pub update_command_list: ULGPUDriverUpdateCommandListCallback,
3000}
3001#[test]
3002fn bindgen_test_layout_ULGPUDriver() {
3003 const UNINIT: ::std::mem::MaybeUninit<ULGPUDriver> = ::std::mem::MaybeUninit::uninit();
3004 let ptr = UNINIT.as_ptr();
3005 assert_eq!(
3006 ::std::mem::size_of::<ULGPUDriver>(),
3007 112usize,
3008 concat!("Size of: ", stringify!(ULGPUDriver))
3009 );
3010 assert_eq!(
3011 ::std::mem::align_of::<ULGPUDriver>(),
3012 8usize,
3013 concat!("Alignment of ", stringify!(ULGPUDriver))
3014 );
3015 assert_eq!(
3016 unsafe { ::std::ptr::addr_of!((*ptr).begin_synchronize) as usize - ptr as usize },
3017 0usize,
3018 concat!(
3019 "Offset of field: ",
3020 stringify!(ULGPUDriver),
3021 "::",
3022 stringify!(begin_synchronize)
3023 )
3024 );
3025 assert_eq!(
3026 unsafe { ::std::ptr::addr_of!((*ptr).end_synchronize) as usize - ptr as usize },
3027 8usize,
3028 concat!(
3029 "Offset of field: ",
3030 stringify!(ULGPUDriver),
3031 "::",
3032 stringify!(end_synchronize)
3033 )
3034 );
3035 assert_eq!(
3036 unsafe { ::std::ptr::addr_of!((*ptr).next_texture_id) as usize - ptr as usize },
3037 16usize,
3038 concat!(
3039 "Offset of field: ",
3040 stringify!(ULGPUDriver),
3041 "::",
3042 stringify!(next_texture_id)
3043 )
3044 );
3045 assert_eq!(
3046 unsafe { ::std::ptr::addr_of!((*ptr).create_texture) as usize - ptr as usize },
3047 24usize,
3048 concat!(
3049 "Offset of field: ",
3050 stringify!(ULGPUDriver),
3051 "::",
3052 stringify!(create_texture)
3053 )
3054 );
3055 assert_eq!(
3056 unsafe { ::std::ptr::addr_of!((*ptr).update_texture) as usize - ptr as usize },
3057 32usize,
3058 concat!(
3059 "Offset of field: ",
3060 stringify!(ULGPUDriver),
3061 "::",
3062 stringify!(update_texture)
3063 )
3064 );
3065 assert_eq!(
3066 unsafe { ::std::ptr::addr_of!((*ptr).destroy_texture) as usize - ptr as usize },
3067 40usize,
3068 concat!(
3069 "Offset of field: ",
3070 stringify!(ULGPUDriver),
3071 "::",
3072 stringify!(destroy_texture)
3073 )
3074 );
3075 assert_eq!(
3076 unsafe { ::std::ptr::addr_of!((*ptr).next_render_buffer_id) as usize - ptr as usize },
3077 48usize,
3078 concat!(
3079 "Offset of field: ",
3080 stringify!(ULGPUDriver),
3081 "::",
3082 stringify!(next_render_buffer_id)
3083 )
3084 );
3085 assert_eq!(
3086 unsafe { ::std::ptr::addr_of!((*ptr).create_render_buffer) as usize - ptr as usize },
3087 56usize,
3088 concat!(
3089 "Offset of field: ",
3090 stringify!(ULGPUDriver),
3091 "::",
3092 stringify!(create_render_buffer)
3093 )
3094 );
3095 assert_eq!(
3096 unsafe { ::std::ptr::addr_of!((*ptr).destroy_render_buffer) as usize - ptr as usize },
3097 64usize,
3098 concat!(
3099 "Offset of field: ",
3100 stringify!(ULGPUDriver),
3101 "::",
3102 stringify!(destroy_render_buffer)
3103 )
3104 );
3105 assert_eq!(
3106 unsafe { ::std::ptr::addr_of!((*ptr).next_geometry_id) as usize - ptr as usize },
3107 72usize,
3108 concat!(
3109 "Offset of field: ",
3110 stringify!(ULGPUDriver),
3111 "::",
3112 stringify!(next_geometry_id)
3113 )
3114 );
3115 assert_eq!(
3116 unsafe { ::std::ptr::addr_of!((*ptr).create_geometry) as usize - ptr as usize },
3117 80usize,
3118 concat!(
3119 "Offset of field: ",
3120 stringify!(ULGPUDriver),
3121 "::",
3122 stringify!(create_geometry)
3123 )
3124 );
3125 assert_eq!(
3126 unsafe { ::std::ptr::addr_of!((*ptr).update_geometry) as usize - ptr as usize },
3127 88usize,
3128 concat!(
3129 "Offset of field: ",
3130 stringify!(ULGPUDriver),
3131 "::",
3132 stringify!(update_geometry)
3133 )
3134 );
3135 assert_eq!(
3136 unsafe { ::std::ptr::addr_of!((*ptr).destroy_geometry) as usize - ptr as usize },
3137 96usize,
3138 concat!(
3139 "Offset of field: ",
3140 stringify!(ULGPUDriver),
3141 "::",
3142 stringify!(destroy_geometry)
3143 )
3144 );
3145 assert_eq!(
3146 unsafe { ::std::ptr::addr_of!((*ptr).update_command_list) as usize - ptr as usize },
3147 104usize,
3148 concat!(
3149 "Offset of field: ",
3150 stringify!(ULGPUDriver),
3151 "::",
3152 stringify!(update_command_list)
3153 )
3154 );
3155}
3156extern "C" {
3157 #[doc = "\n Sets up an orthographic projection matrix with a certain viewport width and height, multiplies\n it by 'transform', and returns the result.\n\n This should be used to calculate the model-view projection matrix for the vertex shaders using\n the current ULGPUState.\n\n The 'flip_y' can be optionally used to flip the Y coordinate-space. (Usually flip_y == true for\n OpenGL)\n"]
3158 pub fn ulApplyProjection(
3159 transform: ULMatrix4x4,
3160 viewport_width: f32,
3161 viewport_height: f32,
3162 flip_y: bool,
3163 ) -> ULMatrix4x4;
3164}
3165extern "C" {
3166 #[doc = "\n Create a key event, @see KeyEvent for help with the following parameters.\n"]
3167 pub fn ulCreateKeyEvent(
3168 type_: ULKeyEventType,
3169 modifiers: ::std::os::raw::c_uint,
3170 virtual_key_code: ::std::os::raw::c_int,
3171 native_key_code: ::std::os::raw::c_int,
3172 text: ULString,
3173 unmodified_text: ULString,
3174 is_keypad: bool,
3175 is_auto_repeat: bool,
3176 is_system_key: bool,
3177 ) -> ULKeyEvent;
3178}
3179extern "C" {
3180 #[doc = "\n Destroy a key event.\n"]
3181 pub fn ulDestroyKeyEvent(evt: ULKeyEvent);
3182}
3183pub const ULLogLevel_kLogLevel_Error: ULLogLevel = 0;
3184pub const ULLogLevel_kLogLevel_Warning: ULLogLevel = 1;
3185pub const ULLogLevel_kLogLevel_Info: ULLogLevel = 2;
3186#[doc = " Logger"]
3187pub type ULLogLevel = ::std::os::raw::c_uint;
3188#[doc = "\n The callback invoked when the library wants to print a message to the log.\n"]
3189pub type ULLoggerLogMessageCallback =
3190 ::std::option::Option<unsafe extern "C" fn(log_level: ULLogLevel, message: ULString)>;
3191#[repr(C)]
3192#[derive(Debug, Default, Copy, Clone)]
3193pub struct ULLogger {
3194 pub log_message: ULLoggerLogMessageCallback,
3195}
3196#[test]
3197fn bindgen_test_layout_ULLogger() {
3198 const UNINIT: ::std::mem::MaybeUninit<ULLogger> = ::std::mem::MaybeUninit::uninit();
3199 let ptr = UNINIT.as_ptr();
3200 assert_eq!(
3201 ::std::mem::size_of::<ULLogger>(),
3202 8usize,
3203 concat!("Size of: ", stringify!(ULLogger))
3204 );
3205 assert_eq!(
3206 ::std::mem::align_of::<ULLogger>(),
3207 8usize,
3208 concat!("Alignment of ", stringify!(ULLogger))
3209 );
3210 assert_eq!(
3211 unsafe { ::std::ptr::addr_of!((*ptr).log_message) as usize - ptr as usize },
3212 0usize,
3213 concat!(
3214 "Offset of field: ",
3215 stringify!(ULLogger),
3216 "::",
3217 stringify!(log_message)
3218 )
3219 );
3220}
3221extern "C" {
3222 #[doc = "\n Create a mouse event, @see MouseEvent for help using this function.\n"]
3223 pub fn ulCreateMouseEvent(
3224 type_: ULMouseEventType,
3225 x: ::std::os::raw::c_int,
3226 y: ::std::os::raw::c_int,
3227 button: ULMouseButton,
3228 ) -> ULMouseEvent;
3229}
3230extern "C" {
3231 #[doc = "\n Destroy a mouse event.\n"]
3232 pub fn ulDestroyMouseEvent(evt: ULMouseEvent);
3233}
3234extern "C" {
3235 #[doc = "\n Width (in pixels).\n"]
3236 pub fn ulSurfaceGetWidth(surface: ULSurface) -> ::std::os::raw::c_uint;
3237}
3238extern "C" {
3239 #[doc = "\n Height (in pixels).\n"]
3240 pub fn ulSurfaceGetHeight(surface: ULSurface) -> ::std::os::raw::c_uint;
3241}
3242extern "C" {
3243 #[doc = "\n Number of bytes between rows (usually width * 4)\n"]
3244 pub fn ulSurfaceGetRowBytes(surface: ULSurface) -> ::std::os::raw::c_uint;
3245}
3246extern "C" {
3247 #[doc = "\n Size in bytes.\n"]
3248 pub fn ulSurfaceGetSize(surface: ULSurface) -> usize;
3249}
3250extern "C" {
3251 #[doc = "\n Lock the pixel buffer and get a pointer to the beginning of the data for reading/writing.\n\n Native pixel format is premultiplied BGRA 32-bit (8 bits per channel).\n"]
3252 pub fn ulSurfaceLockPixels(surface: ULSurface) -> *mut ::std::os::raw::c_void;
3253}
3254extern "C" {
3255 #[doc = "\n Unlock the pixel buffer.\n"]
3256 pub fn ulSurfaceUnlockPixels(surface: ULSurface);
3257}
3258extern "C" {
3259 #[doc = "\n Resize the pixel buffer to a certain width and height (both in pixels).\n\n This should never be called while pixels are locked.\n"]
3260 pub fn ulSurfaceResize(
3261 surface: ULSurface,
3262 width: ::std::os::raw::c_uint,
3263 height: ::std::os::raw::c_uint,
3264 );
3265}
3266extern "C" {
3267 #[doc = "\n Set the dirty bounds to a certain value.\n\n This is called after the Renderer paints to an area of the pixel buffer. (The new value will be\n joined with the existing dirty_bounds())\n"]
3268 pub fn ulSurfaceSetDirtyBounds(surface: ULSurface, bounds: ULIntRect);
3269}
3270extern "C" {
3271 #[doc = "\n Get the dirty bounds.\n\n This value can be used to determine which portion of the pixel buffer has been updated since the\n last call to ulSurfaceClearDirtyBounds().\n\n The general algorithm to determine if a Surface needs display is:\n <pre>\n if (!ulIntRectIsEmpty(ulSurfaceGetDirtyBounds(surface))) {\n // Surface pixels are dirty and needs display.\n // Cast Surface to native Surface and use it here (pseudo code)\n DisplaySurface(surface);\n\n // Once you're done, clear the dirty bounds:\n ulSurfaceClearDirtyBounds(surface);\n }\n </pre>\n"]
3272 pub fn ulSurfaceGetDirtyBounds(surface: ULSurface) -> ULIntRect;
3273}
3274extern "C" {
3275 #[doc = "\n Clear the dirty bounds.\n\n You should call this after you're done displaying the Surface.\n"]
3276 pub fn ulSurfaceClearDirtyBounds(surface: ULSurface);
3277}
3278extern "C" {
3279 #[doc = "\n Get the underlying user data pointer (this is only valid if you have set a custom surface\n implementation via ulPlatformSetSurfaceDefinition).\n\n This will return nullptr if this surface is the default ULBitmapSurface.\n"]
3280 pub fn ulSurfaceGetUserData(surface: ULSurface) -> *mut ::std::os::raw::c_void;
3281}
3282extern "C" {
3283 #[doc = "\n Get the underlying Bitmap from the default Surface.\n\n @note Do not call ulDestroyBitmap() on the returned value, it is owned by the surface.\n"]
3284 pub fn ulBitmapSurfaceGetBitmap(surface: ULBitmapSurface) -> ULBitmap;
3285}
3286#[doc = "\n The callback invoked when a Surface is created.\n\n @param width The width in pixels.\n @param height The height in pixels.\n\n @return This callback should return a pointer to user-defined data for the instance. This user\n data pointer will be passed to all other callbacks when operating on the instance.\n"]
3287pub type ULSurfaceDefinitionCreateCallback = ::std::option::Option<
3288 unsafe extern "C" fn(
3289 width: ::std::os::raw::c_uint,
3290 height: ::std::os::raw::c_uint,
3291 ) -> *mut ::std::os::raw::c_void,
3292>;
3293#[doc = "\n The callback invoked when a Surface is destroyed.\n\n @param user_data User data pointer uniquely identifying the surface.\n"]
3294pub type ULSurfaceDefinitionDestroyCallback =
3295 ::std::option::Option<unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void)>;
3296#[doc = "\n The callback invoked when a Surface's width (in pixels) is requested.\n\n @param user_data User data pointer uniquely identifying the surface.\n"]
3297pub type ULSurfaceDefinitionGetWidthCallback = ::std::option::Option<
3298 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_uint,
3299>;
3300#[doc = "\n The callback invoked when a Surface's height (in pixels) is requested.\n\n @param user_data User data pointer uniquely identifying the surface.\n"]
3301pub type ULSurfaceDefinitionGetHeightCallback = ::std::option::Option<
3302 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_uint,
3303>;
3304#[doc = "\n The callback invoked when a Surface's row bytes is requested.\n\n @note This value is also known as \"stride\". Usually width * 4.\n\n @param user_data User data pointer uniquely identifying the surface.\n"]
3305pub type ULSurfaceDefinitionGetRowBytesCallback = ::std::option::Option<
3306 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_uint,
3307>;
3308#[doc = "\n The callback invoked when a Surface's size (in bytes) is requested.\n\n @param user_data User data pointer uniquely identifying the surface.\n"]
3309pub type ULSurfaceDefinitionGetSizeCallback =
3310 ::std::option::Option<unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void) -> usize>;
3311#[doc = "\n The callback invoked when a Surface's pixel buffer is requested to be locked for reading/writing\n (should return a pointer to locked bytes).\n\n @param user_data User data pointer uniquely identifying the surface.\n"]
3312pub type ULSurfaceDefinitionLockPixelsCallback = ::std::option::Option<
3313 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void,
3314>;
3315#[doc = "\n The callback invoked when a Surface's pixel buffer is requested to be unlocked after previously\n being locked.\n\n @param user_data User data pointer uniquely identifying the surface.\n"]
3316pub type ULSurfaceDefinitionUnlockPixelsCallback =
3317 ::std::option::Option<unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void)>;
3318#[doc = "\n The callback invoked when a Surface is requested to be resized to a certain width/height.\n\n @param user_data User data pointer uniquely identifying the surface.\n\n @param width Width in pixels.\n\n @param height Height in pixels.\n"]
3319pub type ULSurfaceDefinitionResizeCallback = ::std::option::Option<
3320 unsafe extern "C" fn(
3321 user_data: *mut ::std::os::raw::c_void,
3322 width: ::std::os::raw::c_uint,
3323 height: ::std::os::raw::c_uint,
3324 ),
3325>;
3326#[repr(C)]
3327#[derive(Debug, Default, Copy, Clone)]
3328pub struct ULSurfaceDefinition {
3329 pub create: ULSurfaceDefinitionCreateCallback,
3330 pub destroy: ULSurfaceDefinitionDestroyCallback,
3331 pub get_width: ULSurfaceDefinitionGetWidthCallback,
3332 pub get_height: ULSurfaceDefinitionGetHeightCallback,
3333 pub get_row_bytes: ULSurfaceDefinitionGetRowBytesCallback,
3334 pub get_size: ULSurfaceDefinitionGetSizeCallback,
3335 pub lock_pixels: ULSurfaceDefinitionLockPixelsCallback,
3336 pub unlock_pixels: ULSurfaceDefinitionUnlockPixelsCallback,
3337 pub resize: ULSurfaceDefinitionResizeCallback,
3338}
3339#[test]
3340fn bindgen_test_layout_ULSurfaceDefinition() {
3341 const UNINIT: ::std::mem::MaybeUninit<ULSurfaceDefinition> = ::std::mem::MaybeUninit::uninit();
3342 let ptr = UNINIT.as_ptr();
3343 assert_eq!(
3344 ::std::mem::size_of::<ULSurfaceDefinition>(),
3345 72usize,
3346 concat!("Size of: ", stringify!(ULSurfaceDefinition))
3347 );
3348 assert_eq!(
3349 ::std::mem::align_of::<ULSurfaceDefinition>(),
3350 8usize,
3351 concat!("Alignment of ", stringify!(ULSurfaceDefinition))
3352 );
3353 assert_eq!(
3354 unsafe { ::std::ptr::addr_of!((*ptr).create) as usize - ptr as usize },
3355 0usize,
3356 concat!(
3357 "Offset of field: ",
3358 stringify!(ULSurfaceDefinition),
3359 "::",
3360 stringify!(create)
3361 )
3362 );
3363 assert_eq!(
3364 unsafe { ::std::ptr::addr_of!((*ptr).destroy) as usize - ptr as usize },
3365 8usize,
3366 concat!(
3367 "Offset of field: ",
3368 stringify!(ULSurfaceDefinition),
3369 "::",
3370 stringify!(destroy)
3371 )
3372 );
3373 assert_eq!(
3374 unsafe { ::std::ptr::addr_of!((*ptr).get_width) as usize - ptr as usize },
3375 16usize,
3376 concat!(
3377 "Offset of field: ",
3378 stringify!(ULSurfaceDefinition),
3379 "::",
3380 stringify!(get_width)
3381 )
3382 );
3383 assert_eq!(
3384 unsafe { ::std::ptr::addr_of!((*ptr).get_height) as usize - ptr as usize },
3385 24usize,
3386 concat!(
3387 "Offset of field: ",
3388 stringify!(ULSurfaceDefinition),
3389 "::",
3390 stringify!(get_height)
3391 )
3392 );
3393 assert_eq!(
3394 unsafe { ::std::ptr::addr_of!((*ptr).get_row_bytes) as usize - ptr as usize },
3395 32usize,
3396 concat!(
3397 "Offset of field: ",
3398 stringify!(ULSurfaceDefinition),
3399 "::",
3400 stringify!(get_row_bytes)
3401 )
3402 );
3403 assert_eq!(
3404 unsafe { ::std::ptr::addr_of!((*ptr).get_size) as usize - ptr as usize },
3405 40usize,
3406 concat!(
3407 "Offset of field: ",
3408 stringify!(ULSurfaceDefinition),
3409 "::",
3410 stringify!(get_size)
3411 )
3412 );
3413 assert_eq!(
3414 unsafe { ::std::ptr::addr_of!((*ptr).lock_pixels) as usize - ptr as usize },
3415 48usize,
3416 concat!(
3417 "Offset of field: ",
3418 stringify!(ULSurfaceDefinition),
3419 "::",
3420 stringify!(lock_pixels)
3421 )
3422 );
3423 assert_eq!(
3424 unsafe { ::std::ptr::addr_of!((*ptr).unlock_pixels) as usize - ptr as usize },
3425 56usize,
3426 concat!(
3427 "Offset of field: ",
3428 stringify!(ULSurfaceDefinition),
3429 "::",
3430 stringify!(unlock_pixels)
3431 )
3432 );
3433 assert_eq!(
3434 unsafe { ::std::ptr::addr_of!((*ptr).resize) as usize - ptr as usize },
3435 64usize,
3436 concat!(
3437 "Offset of field: ",
3438 stringify!(ULSurfaceDefinition),
3439 "::",
3440 stringify!(resize)
3441 )
3442 );
3443}
3444extern "C" {
3445 #[doc = "\n Set a custom Logger implementation.\n\n This is used to log debug messages to the console or to a log file.\n\n You should call this before ulCreateRenderer() or ulCreateApp().\n\n @note ulCreateApp() will use the default logger if you never call this.\n\n @note If you're not using ulCreateApp(), (eg, using ulCreateRenderer()) you can still use the\n default logger by calling ulEnableDefaultLogger() (@see <AppCore/CAPI.h>)\n"]
3446 pub fn ulPlatformSetLogger(logger: ULLogger);
3447}
3448extern "C" {
3449 #[doc = "\n Set a custom FileSystem implementation.\n\n The library uses this to load all file URLs (eg, <file:///page.html>).\n\n You can provide the library with your own FileSystem implementation so that file assets are\n loaded from your own pipeline.\n\n You should call this before ulCreateRenderer() or ulCreateApp().\n\n @warning This is required to be defined before calling ulCreateRenderer()\n\n @note ulCreateApp() will use the default platform file system if you never call this.\n\n @note If you're not using ulCreateApp(), (eg, using ulCreateRenderer()) you can still use the\n default platform file system by calling ulEnablePlatformFileSystem()'\n (@see <AppCore/CAPI.h>)\n"]
3450 pub fn ulPlatformSetFileSystem(file_system: ULFileSystem);
3451}
3452extern "C" {
3453 #[doc = "\n Set a custom FontLoader implementation.\n\n The library uses this to load all system fonts.\n\n Every operating system has its own library of installed system fonts. The FontLoader interface\n is used to lookup these fonts and fetch the actual font data (raw TTF/OTF file data) for a given\n given font description.\n\n You should call this before ulCreateRenderer() or ulCreateApp().\n\n @warning This is required to be defined before calling ulCreateRenderer()\n\n @note ulCreateApp() will use the default platform font loader if you never call this.\n\n @note If you're not using ulCreateApp(), (eg, using ulCreateRenderer()) you can still use the\n default platform font loader by calling ulEnablePlatformFontLoader()'\n (@see <AppCore/CAPI.h>)\n"]
3454 pub fn ulPlatformSetFontLoader(font_loader: ULFontLoader);
3455}
3456extern "C" {
3457 #[doc = "\n Set a custom Surface implementation.\n\n This can be used to wrap a platform-specific GPU texture, Windows DIB, macOS CGImage, or any\n other pixel buffer target for display on screen.\n\n By default, the library uses a bitmap surface for all surfaces but you can override this by\n providing your own surface definition here.\n\n You should call this before ulCreateRenderer() or ulCreateApp().\n"]
3458 pub fn ulPlatformSetSurfaceDefinition(surface_definition: ULSurfaceDefinition);
3459}
3460extern "C" {
3461 #[doc = "\n Set a custom GPUDriver implementation.\n\n This should be used if you have enabled the GPU renderer in the Config and are using\n ulCreateRenderer() (which does not provide its own GPUDriver implementation).\n\n The GPUDriver interface is used by the library to dispatch GPU calls to your native GPU context\n (eg, D3D11, Metal, OpenGL, Vulkan, etc.) There are reference implementations for this interface\n in the AppCore repo.\n\n You should call this before ulCreateRenderer().\n"]
3462 pub fn ulPlatformSetGPUDriver(gpu_driver: ULGPUDriver);
3463}
3464extern "C" {
3465 #[doc = "\n Set a custom Clipboard implementation.\n\n This should be used if you are using ulCreateRenderer() (which does not provide its own\n clipboard implementation).\n\n The Clipboard interface is used by the library to make calls to the system's native clipboard\n (eg, cut, copy, paste).\n\n You should call this before ulCreateRenderer().\n"]
3466 pub fn ulPlatformSetClipboard(clipboard: ULClipboard);
3467}
3468extern "C" {
3469 #[doc = "\n Create the core renderer singleton for the library directly.\n\n Unlike ulCreateApp(), this does not use any native windows for drawing and allows you to manage\n your own runloop and painting. This method is recommended for those wishing to integrate the\n library into a game.\n\n This singleton manages the lifetime of all Views and coordinates all painting, rendering,\n network requests, and event dispatch.\n\n You should only call this once per process lifetime.\n\n You must set up your platform handlers before calling this. At a minimum, you must call\n ulPlatformSetFileSystem() and ulPlatformSetFontLoader() before calling this.\n\n @note You should not call this if you are using ulCreateApp(), it creates its own renderer and\n provides default implementations for various platform handlers automatically.\n"]
3470 pub fn ulCreateRenderer(config: ULConfig) -> ULRenderer;
3471}
3472extern "C" {
3473 #[doc = "\n Destroy the renderer.\n"]
3474 pub fn ulDestroyRenderer(renderer: ULRenderer);
3475}
3476extern "C" {
3477 #[doc = "\n Update timers and dispatch internal callbacks (JavaScript and network).\n"]
3478 pub fn ulUpdate(renderer: ULRenderer);
3479}
3480extern "C" {
3481 #[doc = "\n Notify the renderer that a display has refreshed (you should call this after vsync).\n\n This updates animations, smooth scroll, and window.requestAnimationFrame() for all Views\n matching the display id.\n"]
3482 pub fn ulRefreshDisplay(renderer: ULRenderer, display_id: ::std::os::raw::c_uint);
3483}
3484extern "C" {
3485 #[doc = "\n Render all active Views.\n"]
3486 pub fn ulRender(renderer: ULRenderer);
3487}
3488extern "C" {
3489 #[doc = "\n Attempt to release as much memory as possible. Don't call this from any callbacks or driver\n code.\n"]
3490 pub fn ulPurgeMemory(renderer: ULRenderer);
3491}
3492extern "C" {
3493 #[doc = "\n Print detailed memory usage statistics to the log. (@see ulPlatformSetLogger)\n"]
3494 pub fn ulLogMemoryUsage(renderer: ULRenderer);
3495}
3496extern "C" {
3497 #[doc = "\n Start the remote inspector server.\n\n While the remote inspector is active, Views that are loaded into this renderer\n will be able to be remotely inspected from another Ultralight instance either locally\n (another app on same machine) or remotely (over the network) by navigating a View to:\n\n \\code\n inspector://<ADDRESS>:<PORT>\n \\endcode\n\n @return Returns whether the server started successfully or not.\n"]
3498 pub fn ulStartRemoteInspectorServer(
3499 renderer: ULRenderer,
3500 address: *const ::std::os::raw::c_char,
3501 port: ::std::os::raw::c_ushort,
3502 ) -> bool;
3503}
3504extern "C" {
3505 #[doc = "\n Describe the details of a gamepad, to be used with ulFireGamepadEvent and related\n events below. This can be called multiple times with the same index if the details change.\n\n @param renderer The active renderer instance.\n\n @param index The unique index (or \"connection slot\") of the gamepad. For example,\n controller #1 would be \"1\", controller #2 would be \"2\" and so on.\n\n @param id A string ID representing the device, this will be made available\n in JavaScript as gamepad.id\n\n @param axis_count The number of axes on the device.\n\n @param button_count The number of buttons on the device.\n"]
3506 pub fn ulSetGamepadDetails(
3507 renderer: ULRenderer,
3508 index: ::std::os::raw::c_uint,
3509 id: ULString,
3510 axis_count: ::std::os::raw::c_uint,
3511 button_count: ::std::os::raw::c_uint,
3512 );
3513}
3514extern "C" {
3515 #[doc = "\n Fire a gamepad event (connection / disconnection).\n\n @note The gamepad should first be described via ulSetGamepadDetails before calling this\n function.\n\n @see <https://developer.mozilla.org/en-US/docs/Web/API/Gamepad>\n"]
3516 pub fn ulFireGamepadEvent(renderer: ULRenderer, evt: ULGamepadEvent);
3517}
3518extern "C" {
3519 #[doc = "\n Fire a gamepad axis event (to be called when an axis value is changed).\n\n @note The gamepad should be connected via a previous call to ulFireGamepadEvent.\n\n @see <https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/axes>\n"]
3520 pub fn ulFireGamepadAxisEvent(renderer: ULRenderer, evt: ULGamepadAxisEvent);
3521}
3522extern "C" {
3523 #[doc = "\n Fire a gamepad button event (to be called when a button value is changed).\n\n @note The gamepad should be connected via a previous call to ulFireGamepadEvent.\n\n @see <https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/buttons>\n"]
3524 pub fn ulFireGamepadButtonEvent(renderer: ULRenderer, evt: ULGamepadButtonEvent);
3525}
3526extern "C" {
3527 #[doc = "\n Create a scroll event, @see ScrollEvent for help using this function.\n"]
3528 pub fn ulCreateScrollEvent(
3529 type_: ULScrollEventType,
3530 delta_x: ::std::os::raw::c_int,
3531 delta_y: ::std::os::raw::c_int,
3532 ) -> ULScrollEvent;
3533}
3534extern "C" {
3535 #[doc = "\n Destroy a scroll event.\n"]
3536 pub fn ulDestroyScrollEvent(evt: ULScrollEvent);
3537}
3538extern "C" {
3539 #[doc = "\n Create a gamepad event, see GamepadEvent for help using this function.\n"]
3540 pub fn ulCreateGamepadEvent(
3541 index: ::std::os::raw::c_uint,
3542 type_: ULGamepadEventType,
3543 ) -> ULGamepadEvent;
3544}
3545extern "C" {
3546 #[doc = "\n Destroy a gamepad event.\n"]
3547 pub fn ulDestroyGamepadEvent(evt: ULGamepadEvent);
3548}
3549extern "C" {
3550 #[doc = "\n Create a gamepad axis event, see GamepadAxisEvent for help using this function.\n"]
3551 pub fn ulCreateGamepadAxisEvent(
3552 index: ::std::os::raw::c_uint,
3553 axis_index: ::std::os::raw::c_uint,
3554 value: f64,
3555 ) -> ULGamepadAxisEvent;
3556}
3557extern "C" {
3558 #[doc = "\n Destroy a gamepad axis event.\n"]
3559 pub fn ulDestroyGamepadAxisEvent(evt: ULGamepadAxisEvent);
3560}
3561extern "C" {
3562 #[doc = "\n Create a gamepad button event, see GamepadButtonEvent for help using this function.\n"]
3563 pub fn ulCreateGamepadButtonEvent(
3564 index: ::std::os::raw::c_uint,
3565 button_index: ::std::os::raw::c_uint,
3566 value: f64,
3567 ) -> ULGamepadButtonEvent;
3568}
3569extern "C" {
3570 #[doc = "\n Destroy a gamepad button event.\n"]
3571 pub fn ulDestroyGamepadButtonEvent(evt: ULGamepadButtonEvent);
3572}
3573extern "C" {
3574 #[doc = "\n Create a Session to store local data in (such as cookies, local storage, application cache,\n indexed db, etc).\n"]
3575 pub fn ulCreateSession(renderer: ULRenderer, is_persistent: bool, name: ULString) -> ULSession;
3576}
3577extern "C" {
3578 #[doc = "\n Destroy a Session.\n"]
3579 pub fn ulDestroySession(session: ULSession);
3580}
3581extern "C" {
3582 #[doc = "\n Get the default session (persistent session named \"default\").\n\n @note This session is owned by the Renderer, you shouldn't destroy it.\n"]
3583 pub fn ulDefaultSession(renderer: ULRenderer) -> ULSession;
3584}
3585extern "C" {
3586 #[doc = "\n Whether or not is persistent (backed to disk).\n"]
3587 pub fn ulSessionIsPersistent(session: ULSession) -> bool;
3588}
3589extern "C" {
3590 #[doc = "\n Unique name identifying the session (used for unique disk path).\n"]
3591 pub fn ulSessionGetName(session: ULSession) -> ULString;
3592}
3593extern "C" {
3594 #[doc = "\n Unique numeric Id for the session.\n"]
3595 pub fn ulSessionGetId(session: ULSession) -> ::std::os::raw::c_ulonglong;
3596}
3597extern "C" {
3598 #[doc = "\n The disk path to write to (used by persistent sessions only).\n"]
3599 pub fn ulSessionGetDiskPath(session: ULSession) -> ULString;
3600}
3601extern "C" {
3602 #[doc = "\n Create view configuration with default values (see <Ultralight/platform/View.h>).\n"]
3603 pub fn ulCreateViewConfig() -> ULViewConfig;
3604}
3605extern "C" {
3606 #[doc = "\n Destroy view configuration.\n"]
3607 pub fn ulDestroyViewConfig(config: ULViewConfig);
3608}
3609extern "C" {
3610 #[doc = "\n Set a user-generated id of the display (monitor, TV, or screen) that the View will be shown on.\n\n Animations are driven based on the physical refresh rate of the display. Multiple Views can\n share the same display.\n\n\n @note This is automatically managed for you when ulCreateApp() is used.\n\n @see ulRefreshDisplay()\n"]
3611 pub fn ulViewConfigSetDisplayId(config: ULViewConfig, display_id: ::std::os::raw::c_uint);
3612}
3613extern "C" {
3614 #[doc = "\n Set whether to render using the GPU renderer (accelerated) or the CPU renderer (unaccelerated).\n\n This option is only valid if you're managing the Renderer yourself (eg, you've previously\n called ulCreateRenderer() instead of ulCreateApp()).\n\n When true, the View will be rendered to an offscreen GPU texture using the GPU driver set in\n ulPlatformSetGPUDriver(). You can fetch details for the texture via ulViewGetRenderTarget().\n\n When false (the default), the View will be rendered to an offscreen pixel buffer using the\n multithreaded CPU renderer. This pixel buffer can optionally be provided by the user--\n for more info see ulViewGetSurface().\n"]
3615 pub fn ulViewConfigSetIsAccelerated(config: ULViewConfig, is_accelerated: bool);
3616}
3617extern "C" {
3618 #[doc = "\n Set whether images should be enabled (Default = True).\n"]
3619 pub fn ulViewConfigSetIsTransparent(config: ULViewConfig, is_transparent: bool);
3620}
3621extern "C" {
3622 #[doc = "\n Set the initial device scale, ie. the amount to scale page units to screen pixels. This should be\n set to the scaling factor of the device that the View is displayed on. (Default = 1.0)\n\n @note 1.0 is equal to 100% zoom (no scaling), 2.0 is equal to 200% zoom (2x scaling)\n"]
3623 pub fn ulViewConfigSetInitialDeviceScale(config: ULViewConfig, initial_device_scale: f64);
3624}
3625extern "C" {
3626 #[doc = "\n Set whether or not the View should initially have input focus. (Default = True)\n"]
3627 pub fn ulViewConfigSetInitialFocus(config: ULViewConfig, is_focused: bool);
3628}
3629extern "C" {
3630 #[doc = "\n Set whether images should be enabled (Default = True).\n"]
3631 pub fn ulViewConfigSetEnableImages(config: ULViewConfig, enabled: bool);
3632}
3633extern "C" {
3634 #[doc = "\n Set whether JavaScript should be enabled (Default = True).\n"]
3635 pub fn ulViewConfigSetEnableJavaScript(config: ULViewConfig, enabled: bool);
3636}
3637extern "C" {
3638 #[doc = "\n Set default font-family to use (Default = Times New Roman).\n"]
3639 pub fn ulViewConfigSetFontFamilyStandard(config: ULViewConfig, font_name: ULString);
3640}
3641extern "C" {
3642 #[doc = "\n Set default font-family to use for fixed fonts, eg <pre> and <code>\n (Default = Courier New).\n"]
3643 pub fn ulViewConfigSetFontFamilyFixed(config: ULViewConfig, font_name: ULString);
3644}
3645extern "C" {
3646 #[doc = "\n Set default font-family to use for serif fonts (Default = Times New Roman).\n"]
3647 pub fn ulViewConfigSetFontFamilySerif(config: ULViewConfig, font_name: ULString);
3648}
3649extern "C" {
3650 #[doc = "\n Set default font-family to use for sans-serif fonts (Default = Arial).\n"]
3651 pub fn ulViewConfigSetFontFamilySansSerif(config: ULViewConfig, font_name: ULString);
3652}
3653extern "C" {
3654 #[doc = "\n Set user agent string (See <Ultralight/platform/Config.h> for the default).\n"]
3655 pub fn ulViewConfigSetUserAgent(config: ULViewConfig, agent_string: ULString);
3656}
3657extern "C" {
3658 #[doc = "\n Create a View with certain size (in pixels).\n\n @note You can pass null to 'session' to use the default session.\n"]
3659 pub fn ulCreateView(
3660 renderer: ULRenderer,
3661 width: ::std::os::raw::c_uint,
3662 height: ::std::os::raw::c_uint,
3663 view_config: ULViewConfig,
3664 session: ULSession,
3665 ) -> ULView;
3666}
3667extern "C" {
3668 #[doc = "\n Destroy a View.\n"]
3669 pub fn ulDestroyView(view: ULView);
3670}
3671extern "C" {
3672 #[doc = "\n Get current URL.\n\n @note Don't destroy the returned string, it is owned by the View.\n"]
3673 pub fn ulViewGetURL(view: ULView) -> ULString;
3674}
3675extern "C" {
3676 #[doc = "\n Get current title.\n\n @note Don't destroy the returned string, it is owned by the View.\n"]
3677 pub fn ulViewGetTitle(view: ULView) -> ULString;
3678}
3679extern "C" {
3680 #[doc = "\n Get the width, in pixels.\n"]
3681 pub fn ulViewGetWidth(view: ULView) -> ::std::os::raw::c_uint;
3682}
3683extern "C" {
3684 #[doc = "\n Get the height, in pixels.\n"]
3685 pub fn ulViewGetHeight(view: ULView) -> ::std::os::raw::c_uint;
3686}
3687extern "C" {
3688 pub fn ulViewGetDisplayId(view: ULView) -> ::std::os::raw::c_uint;
3689}
3690extern "C" {
3691 #[doc = "\n Set the display id of the View.\n\n This should be called when the View is moved to another display.\n"]
3692 pub fn ulViewSetDisplayId(view: ULView, display_id: ::std::os::raw::c_uint);
3693}
3694extern "C" {
3695 #[doc = "\n Get the device scale, ie. the amount to scale page units to screen pixels.\n\n For example, a value of 1.0 is equivalent to 100% zoom. A value of 2.0 is 200% zoom.\n"]
3696 pub fn ulViewGetDeviceScale(view: ULView) -> f64;
3697}
3698extern "C" {
3699 #[doc = "\n Set the device scale.\n"]
3700 pub fn ulViewSetDeviceScale(view: ULView, scale: f64);
3701}
3702extern "C" {
3703 #[doc = "\n Whether or not the View is GPU-accelerated. If this is false, the page will be rendered\n via the CPU renderer.\n"]
3704 pub fn ulViewIsAccelerated(view: ULView) -> bool;
3705}
3706extern "C" {
3707 #[doc = "\n Whether or not the View supports transparent backgrounds.\n"]
3708 pub fn ulViewIsTransparent(view: ULView) -> bool;
3709}
3710extern "C" {
3711 #[doc = "\n Check if the main frame of the page is currrently loading.\n"]
3712 pub fn ulViewIsLoading(view: ULView) -> bool;
3713}
3714extern "C" {
3715 #[doc = "\n Get the RenderTarget for the View.\n\n @note Only valid if this View is GPU accelerated.\n\n You can use this with your GPUDriver implementation to bind and display the\n corresponding texture in your application.\n"]
3716 pub fn ulViewGetRenderTarget(view: ULView) -> ULRenderTarget;
3717}
3718extern "C" {
3719 #[doc = "\n Get the Surface for the View (native pixel buffer that the CPU renderer draws into).\n\n @note This operation is only valid if you're managing the Renderer yourself (eg, you've\n previously called ulCreateRenderer() instead of ulCreateApp()).\n\n This function will return NULL if this View is GPU accelerated.\n\n The default Surface is BitmapSurface but you can provide your own Surface implementation\n via ulPlatformSetSurfaceDefinition.\n\n When using the default Surface, you can retrieve the underlying bitmap by casting\n ULSurface to ULBitmapSurface and calling ulBitmapSurfaceGetBitmap().\n"]
3720 pub fn ulViewGetSurface(view: ULView) -> ULSurface;
3721}
3722extern "C" {
3723 #[doc = "\n Load a raw string of HTML.\n"]
3724 pub fn ulViewLoadHTML(view: ULView, html_string: ULString);
3725}
3726extern "C" {
3727 #[doc = "\n Load a URL into main frame.\n"]
3728 pub fn ulViewLoadURL(view: ULView, url_string: ULString);
3729}
3730extern "C" {
3731 #[doc = "\n Resize view to a certain width and height (in pixels).\n"]
3732 pub fn ulViewResize(
3733 view: ULView,
3734 width: ::std::os::raw::c_uint,
3735 height: ::std::os::raw::c_uint,
3736 );
3737}
3738extern "C" {
3739 #[doc = "\n Acquire the page's JSContext for use with JavaScriptCore API.\n\n @note This call locks the context for the current thread. You should call\n ulViewUnlockJSContext() after using the context so other worker threads can modify\n JavaScript state.\n\n @note The lock is recusive, it's okay to call this multiple times as long as you call\n ulViewUnlockJSContext() the same number of times.\n"]
3740 pub fn ulViewLockJSContext(view: ULView) -> JSContextRef;
3741}
3742extern "C" {
3743 #[doc = "\n Unlock the page's JSContext after a previous call to ulViewLockJSContext().\n"]
3744 pub fn ulViewUnlockJSContext(view: ULView);
3745}
3746extern "C" {
3747 #[doc = "\n Evaluate a string of JavaScript and return result.\n\n @param js_string The string of JavaScript to evaluate.\n\n @param exception The address of a ULString to store a description of the last exception. Pass\n NULL to ignore this. Don't destroy the exception string returned, it's owned\n by the View.\n\n @note Don't destroy the returned string, it's owned by the View. This value is reset with every\n call-- if you want to retain it you should copy the result to a new string via\n ulCreateStringFromCopy().\n\n @note An example of using this API:\n <pre>\n ULString script = ulCreateString(\"1 + 1\");\n ULString exception;\n ULString result = ulViewEvaluateScript(view, script, &exception);\n /* Use the result (\"2\") and exception description (if any) here. */\n ulDestroyString(script);\n </pre>\n"]
3748 pub fn ulViewEvaluateScript(
3749 view: ULView,
3750 js_string: ULString,
3751 exception: *mut ULString,
3752 ) -> ULString;
3753}
3754extern "C" {
3755 #[doc = "\n Check if can navigate backwards in history.\n"]
3756 pub fn ulViewCanGoBack(view: ULView) -> bool;
3757}
3758extern "C" {
3759 #[doc = "\n Check if can navigate forwards in history.\n"]
3760 pub fn ulViewCanGoForward(view: ULView) -> bool;
3761}
3762extern "C" {
3763 #[doc = "\n Navigate backwards in history.\n"]
3764 pub fn ulViewGoBack(view: ULView);
3765}
3766extern "C" {
3767 #[doc = "\n Navigate forwards in history.\n"]
3768 pub fn ulViewGoForward(view: ULView);
3769}
3770extern "C" {
3771 #[doc = "\n Navigate to arbitrary offset in history.\n"]
3772 pub fn ulViewGoToHistoryOffset(view: ULView, offset: ::std::os::raw::c_int);
3773}
3774extern "C" {
3775 #[doc = "\n Reload current page.\n"]
3776 pub fn ulViewReload(view: ULView);
3777}
3778extern "C" {
3779 #[doc = "\n Stop all page loads.\n"]
3780 pub fn ulViewStop(view: ULView);
3781}
3782extern "C" {
3783 #[doc = "\n Give focus to the View.\n\n You should call this to give visual indication that the View has input focus (changes active\n text selection colors, for example).\n"]
3784 pub fn ulViewFocus(view: ULView);
3785}
3786extern "C" {
3787 #[doc = "\n Remove focus from the View and unfocus any focused input elements.\n\n You should call this to give visual indication that the View has lost input focus.\n"]
3788 pub fn ulViewUnfocus(view: ULView);
3789}
3790extern "C" {
3791 #[doc = "\n Whether or not the View has focus.\n"]
3792 pub fn ulViewHasFocus(view: ULView) -> bool;
3793}
3794extern "C" {
3795 #[doc = "\n Whether or not the View has an input element with visible keyboard focus (indicated by a\n blinking caret).\n\n You can use this to decide whether or not the View should consume keyboard input events (useful\n in games with mixed UI and key handling).\n"]
3796 pub fn ulViewHasInputFocus(view: ULView) -> bool;
3797}
3798extern "C" {
3799 #[doc = "\n Fire a keyboard event.\n"]
3800 pub fn ulViewFireKeyEvent(view: ULView, key_event: ULKeyEvent);
3801}
3802extern "C" {
3803 #[doc = "\n Fire a mouse event.\n"]
3804 pub fn ulViewFireMouseEvent(view: ULView, mouse_event: ULMouseEvent);
3805}
3806extern "C" {
3807 #[doc = "\n Fire a scroll event.\n"]
3808 pub fn ulViewFireScrollEvent(view: ULView, scroll_event: ULScrollEvent);
3809}
3810pub type ULChangeTitleCallback = ::std::option::Option<
3811 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void, caller: ULView, title: ULString),
3812>;
3813extern "C" {
3814 #[doc = "\n Set callback for when the page title changes.\n"]
3815 pub fn ulViewSetChangeTitleCallback(
3816 view: ULView,
3817 callback: ULChangeTitleCallback,
3818 user_data: *mut ::std::os::raw::c_void,
3819 );
3820}
3821pub type ULChangeURLCallback = ::std::option::Option<
3822 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void, caller: ULView, url: ULString),
3823>;
3824extern "C" {
3825 #[doc = "\n Set callback for when the page URL changes.\n"]
3826 pub fn ulViewSetChangeURLCallback(
3827 view: ULView,
3828 callback: ULChangeURLCallback,
3829 user_data: *mut ::std::os::raw::c_void,
3830 );
3831}
3832pub type ULChangeTooltipCallback = ::std::option::Option<
3833 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void, caller: ULView, tooltip: ULString),
3834>;
3835extern "C" {
3836 #[doc = "\n Set callback for when the tooltip changes (usually result of a mouse hover).\n"]
3837 pub fn ulViewSetChangeTooltipCallback(
3838 view: ULView,
3839 callback: ULChangeTooltipCallback,
3840 user_data: *mut ::std::os::raw::c_void,
3841 );
3842}
3843pub type ULChangeCursorCallback = ::std::option::Option<
3844 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void, caller: ULView, cursor: ULCursor),
3845>;
3846extern "C" {
3847 #[doc = "\n Set callback for when the mouse cursor changes.\n"]
3848 pub fn ulViewSetChangeCursorCallback(
3849 view: ULView,
3850 callback: ULChangeCursorCallback,
3851 user_data: *mut ::std::os::raw::c_void,
3852 );
3853}
3854pub type ULAddConsoleMessageCallback = ::std::option::Option<
3855 unsafe extern "C" fn(
3856 user_data: *mut ::std::os::raw::c_void,
3857 caller: ULView,
3858 source: ULMessageSource,
3859 level: ULMessageLevel,
3860 message: ULString,
3861 line_number: ::std::os::raw::c_uint,
3862 column_number: ::std::os::raw::c_uint,
3863 source_id: ULString,
3864 ),
3865>;
3866extern "C" {
3867 #[doc = "\n Set callback for when a message is added to the console (useful for JavaScript / network errors\n and debugging).\n"]
3868 pub fn ulViewSetAddConsoleMessageCallback(
3869 view: ULView,
3870 callback: ULAddConsoleMessageCallback,
3871 user_data: *mut ::std::os::raw::c_void,
3872 );
3873}
3874pub type ULCreateChildViewCallback = ::std::option::Option<
3875 unsafe extern "C" fn(
3876 user_data: *mut ::std::os::raw::c_void,
3877 caller: ULView,
3878 opener_url: ULString,
3879 target_url: ULString,
3880 is_popup: bool,
3881 popup_rect: ULIntRect,
3882 ) -> ULView,
3883>;
3884extern "C" {
3885 #[doc = "\n Set callback for when the page wants to create a new View.\n\n This is usually the result of a user clicking a link with target=\"_blank\" or by JavaScript\n calling window.open(url).\n\n To allow creation of these new Views, you should create a new View in this callback, resize it\n to your container, and return it. You are responsible for displaying the returned View.\n\n You should return NULL if you want to block the action.\n"]
3886 pub fn ulViewSetCreateChildViewCallback(
3887 view: ULView,
3888 callback: ULCreateChildViewCallback,
3889 user_data: *mut ::std::os::raw::c_void,
3890 );
3891}
3892pub type ULCreateInspectorViewCallback = ::std::option::Option<
3893 unsafe extern "C" fn(
3894 user_data: *mut ::std::os::raw::c_void,
3895 caller: ULView,
3896 is_local: bool,
3897 inspected_url: ULString,
3898 ) -> ULView,
3899>;
3900extern "C" {
3901 #[doc = "\n Set callback for when the page wants to create a new View to display the local inspector in.\n\n You should create a new View in this callback, resize it to your\n container, and return it. You are responsible for displaying the returned View.\n"]
3902 pub fn ulViewSetCreateInspectorViewCallback(
3903 view: ULView,
3904 callback: ULCreateInspectorViewCallback,
3905 user_data: *mut ::std::os::raw::c_void,
3906 );
3907}
3908pub type ULBeginLoadingCallback = ::std::option::Option<
3909 unsafe extern "C" fn(
3910 user_data: *mut ::std::os::raw::c_void,
3911 caller: ULView,
3912 frame_id: ::std::os::raw::c_ulonglong,
3913 is_main_frame: bool,
3914 url: ULString,
3915 ),
3916>;
3917extern "C" {
3918 #[doc = "\n Set callback for when the page begins loading a new URL into a frame.\n"]
3919 pub fn ulViewSetBeginLoadingCallback(
3920 view: ULView,
3921 callback: ULBeginLoadingCallback,
3922 user_data: *mut ::std::os::raw::c_void,
3923 );
3924}
3925pub type ULFinishLoadingCallback = ::std::option::Option<
3926 unsafe extern "C" fn(
3927 user_data: *mut ::std::os::raw::c_void,
3928 caller: ULView,
3929 frame_id: ::std::os::raw::c_ulonglong,
3930 is_main_frame: bool,
3931 url: ULString,
3932 ),
3933>;
3934extern "C" {
3935 #[doc = "\n Set callback for when the page finishes loading a URL into a frame.\n"]
3936 pub fn ulViewSetFinishLoadingCallback(
3937 view: ULView,
3938 callback: ULFinishLoadingCallback,
3939 user_data: *mut ::std::os::raw::c_void,
3940 );
3941}
3942pub type ULFailLoadingCallback = ::std::option::Option<
3943 unsafe extern "C" fn(
3944 user_data: *mut ::std::os::raw::c_void,
3945 caller: ULView,
3946 frame_id: ::std::os::raw::c_ulonglong,
3947 is_main_frame: bool,
3948 url: ULString,
3949 description: ULString,
3950 error_domain: ULString,
3951 error_code: ::std::os::raw::c_int,
3952 ),
3953>;
3954extern "C" {
3955 #[doc = "\n Set callback for when an error occurs while loading a URL into a frame.\n"]
3956 pub fn ulViewSetFailLoadingCallback(
3957 view: ULView,
3958 callback: ULFailLoadingCallback,
3959 user_data: *mut ::std::os::raw::c_void,
3960 );
3961}
3962pub type ULWindowObjectReadyCallback = ::std::option::Option<
3963 unsafe extern "C" fn(
3964 user_data: *mut ::std::os::raw::c_void,
3965 caller: ULView,
3966 frame_id: ::std::os::raw::c_ulonglong,
3967 is_main_frame: bool,
3968 url: ULString,
3969 ),
3970>;
3971extern "C" {
3972 #[doc = "\n Set callback for when the JavaScript window object is reset for a new page load.\n\n This is called before any scripts are executed on the page and is the earliest time to setup any\n initial JavaScript state or bindings.\n\n The document is not guaranteed to be loaded/parsed at this point. If you need to make any\n JavaScript calls that are dependent on DOM elements or scripts on the page, use DOMReady\n instead.\n\n The window object is lazily initialized (this will not be called on pages with no scripts).\n"]
3973 pub fn ulViewSetWindowObjectReadyCallback(
3974 view: ULView,
3975 callback: ULWindowObjectReadyCallback,
3976 user_data: *mut ::std::os::raw::c_void,
3977 );
3978}
3979pub type ULDOMReadyCallback = ::std::option::Option<
3980 unsafe extern "C" fn(
3981 user_data: *mut ::std::os::raw::c_void,
3982 caller: ULView,
3983 frame_id: ::std::os::raw::c_ulonglong,
3984 is_main_frame: bool,
3985 url: ULString,
3986 ),
3987>;
3988extern "C" {
3989 #[doc = "\n Set callback for when all JavaScript has been parsed and the document is ready.\n\n This is the best time to make any JavaScript calls that are dependent on DOM elements or scripts\n on the page.\n"]
3990 pub fn ulViewSetDOMReadyCallback(
3991 view: ULView,
3992 callback: ULDOMReadyCallback,
3993 user_data: *mut ::std::os::raw::c_void,
3994 );
3995}
3996pub type ULUpdateHistoryCallback = ::std::option::Option<
3997 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void, caller: ULView),
3998>;
3999extern "C" {
4000 #[doc = "\n Set callback for when the history (back/forward state) is modified.\n"]
4001 pub fn ulViewSetUpdateHistoryCallback(
4002 view: ULView,
4003 callback: ULUpdateHistoryCallback,
4004 user_data: *mut ::std::os::raw::c_void,
4005 );
4006}
4007extern "C" {
4008 #[doc = "\n Set whether or not a view should be repainted during the next call to ulRender.\n\n @note This flag is automatically set whenever the page content changes but you can set it\n directly in case you need to force a repaint.\n"]
4009 pub fn ulViewSetNeedsPaint(view: ULView, needs_paint: bool);
4010}
4011extern "C" {
4012 #[doc = "\n Whether or not a view should be painted during the next call to ulRender.\n"]
4013 pub fn ulViewGetNeedsPaint(view: ULView) -> bool;
4014}
4015extern "C" {
4016 #[doc = "\n Create an Inspector View to inspect / debug this View locally.\n\n This will only succeed if you have the inspector assets in your filesystem-- the inspector\n will look for file:///inspector/Main.html when it first loads.\n\n You must handle ulViewSetCreateInspectorViewCallback so that the library has a View to display\n the inspector in. This function will call the callback only if an inspector view is not\n currently active.\n"]
4017 pub fn ulViewCreateLocalInspectorView(view: ULView);
4018}
4019#[repr(C)]
4020#[derive(Debug, Copy, Clone)]
4021pub struct C_Settings {
4022 _unused: [u8; 0],
4023}
4024pub type ULSettings = *mut C_Settings;
4025#[repr(C)]
4026#[derive(Debug, Copy, Clone)]
4027pub struct C_App {
4028 _unused: [u8; 0],
4029}
4030pub type ULApp = *mut C_App;
4031#[repr(C)]
4032#[derive(Debug, Copy, Clone)]
4033pub struct C_Window {
4034 _unused: [u8; 0],
4035}
4036pub type ULWindow = *mut C_Window;
4037#[repr(C)]
4038#[derive(Debug, Copy, Clone)]
4039pub struct C_Monitor {
4040 _unused: [u8; 0],
4041}
4042pub type ULMonitor = *mut C_Monitor;
4043#[repr(C)]
4044#[derive(Debug, Copy, Clone)]
4045pub struct C_Overlay {
4046 _unused: [u8; 0],
4047}
4048pub type ULOverlay = *mut C_Overlay;
4049pub const ULWindowFlags_kWindowFlags_Borderless: ULWindowFlags = 1;
4050pub const ULWindowFlags_kWindowFlags_Titled: ULWindowFlags = 2;
4051pub const ULWindowFlags_kWindowFlags_Resizable: ULWindowFlags = 4;
4052pub const ULWindowFlags_kWindowFlags_Maximizable: ULWindowFlags = 8;
4053pub const ULWindowFlags_kWindowFlags_Hidden: ULWindowFlags = 16;
4054#[doc = "\n Window creation flags. @see Window::Create\n"]
4055pub type ULWindowFlags = ::std::os::raw::c_uint;
4056extern "C" {
4057 #[doc = "\n Create settings with default values (see <AppCore/App.h>).\n"]
4058 pub fn ulCreateSettings() -> ULSettings;
4059}
4060extern "C" {
4061 #[doc = "\n Destroy settings.\n"]
4062 pub fn ulDestroySettings(settings: ULSettings);
4063}
4064extern "C" {
4065 #[doc = "\n Set the name of the developer of this app.\n\n This is used to generate a unique path to store local application data\n on the user's machine.\n\n Default is \"MyCompany\"\n"]
4066 pub fn ulSettingsSetDeveloperName(settings: ULSettings, name: ULString);
4067}
4068extern "C" {
4069 #[doc = "\n Set the name of this app.\n\n This is used to generate a unique path to store local application data\n on the user's machine.\n\n Default is \"MyApp\"\n"]
4070 pub fn ulSettingsSetAppName(settings: ULSettings, name: ULString);
4071}
4072extern "C" {
4073 #[doc = "\n Set the root file path for our file system, you should set this to the\n relative path where all of your app data is.\n\n This will be used to resolve all file URLs, eg file:///page.html\n\n @note The default path is \"./assets/\"\n\n This relative path is resolved using the following logic:\n - Windows: relative to the executable path\n - Linux: relative to the executable path\n - macOS: relative to YourApp.app/Contents/Resources/\n"]
4074 pub fn ulSettingsSetFileSystemPath(settings: ULSettings, path: ULString);
4075}
4076extern "C" {
4077 #[doc = "\n Set whether or not we should load and compile shaders from the file system\n (eg, from the /shaders/ path, relative to file_system_path).\n\n If this is false (the default), we will instead load pre-compiled shaders\n from memory which speeds up application startup time.\n"]
4078 pub fn ulSettingsSetLoadShadersFromFileSystem(settings: ULSettings, enabled: bool);
4079}
4080extern "C" {
4081 #[doc = "\n We try to use the GPU renderer when a compatible GPU is detected.\n\n Set this to true to force the engine to always use the CPU renderer.\n"]
4082 pub fn ulSettingsSetForceCPURenderer(settings: ULSettings, force_cpu: bool);
4083}
4084extern "C" {
4085 #[doc = "\n Create the App singleton.\n\n @param settings Settings to customize App runtime behavior. You can pass\n NULL for this parameter to use default settings.\n\n @param config Config options for the Ultralight renderer. You can pass\n NULL for this parameter to use default config.\n\n @note You should only create one of these per application lifetime.\n\n @note Certain Config options may be overridden during App creation,\n most commonly Config::face_winding and Config::device_scale_hint.\n"]
4086 pub fn ulCreateApp(settings: ULSettings, config: ULConfig) -> ULApp;
4087}
4088extern "C" {
4089 #[doc = "\n Destroy the App instance.\n"]
4090 pub fn ulDestroyApp(app: ULApp);
4091}
4092pub type ULUpdateCallback =
4093 ::std::option::Option<unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void)>;
4094extern "C" {
4095 #[doc = "\n Set a callback for whenever the App updates. You should update all app\n logic here.\n\n @note This event is fired right before the run loop calls\n Renderer::Update and Renderer::Render.\n"]
4096 pub fn ulAppSetUpdateCallback(
4097 app: ULApp,
4098 callback: ULUpdateCallback,
4099 user_data: *mut ::std::os::raw::c_void,
4100 );
4101}
4102extern "C" {
4103 #[doc = "\n Whether or not the App is running.\n"]
4104 pub fn ulAppIsRunning(app: ULApp) -> bool;
4105}
4106extern "C" {
4107 #[doc = "\n Get the main monitor (this is never NULL).\n\n @note We'll add monitor enumeration later.\n"]
4108 pub fn ulAppGetMainMonitor(app: ULApp) -> ULMonitor;
4109}
4110extern "C" {
4111 #[doc = "\n Get the underlying Renderer instance.\n"]
4112 pub fn ulAppGetRenderer(app: ULApp) -> ULRenderer;
4113}
4114extern "C" {
4115 #[doc = "\n Run the main loop.\n"]
4116 pub fn ulAppRun(app: ULApp);
4117}
4118extern "C" {
4119 #[doc = "\n Quit the application.\n"]
4120 pub fn ulAppQuit(app: ULApp);
4121}
4122extern "C" {
4123 #[doc = "\n Get the monitor's DPI scale (1.0 = 100%).\n"]
4124 pub fn ulMonitorGetScale(monitor: ULMonitor) -> f64;
4125}
4126extern "C" {
4127 #[doc = "\n Get the width of the monitor (in pixels).\n"]
4128 pub fn ulMonitorGetWidth(monitor: ULMonitor) -> ::std::os::raw::c_uint;
4129}
4130extern "C" {
4131 #[doc = "\n Get the height of the monitor (in pixels).\n"]
4132 pub fn ulMonitorGetHeight(monitor: ULMonitor) -> ::std::os::raw::c_uint;
4133}
4134extern "C" {
4135 #[doc = "\n Create a new Window.\n\n @param monitor The monitor to create the Window on.\n\n @param width The width (in screen coordinates).\n\n @param height The height (in screen coordinates).\n\n @param fullscreen Whether or not the window is fullscreen.\n\n @param window_flags Various window flags.\n"]
4136 pub fn ulCreateWindow(
4137 monitor: ULMonitor,
4138 width: ::std::os::raw::c_uint,
4139 height: ::std::os::raw::c_uint,
4140 fullscreen: bool,
4141 window_flags: ::std::os::raw::c_uint,
4142 ) -> ULWindow;
4143}
4144extern "C" {
4145 #[doc = "\n Destroy a Window.\n"]
4146 pub fn ulDestroyWindow(window: ULWindow);
4147}
4148pub type ULCloseCallback = ::std::option::Option<
4149 unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void, window: ULWindow),
4150>;
4151extern "C" {
4152 #[doc = "\n Set a callback to be notified when a window closes.\n"]
4153 pub fn ulWindowSetCloseCallback(
4154 window: ULWindow,
4155 callback: ULCloseCallback,
4156 user_data: *mut ::std::os::raw::c_void,
4157 );
4158}
4159pub type ULResizeCallback = ::std::option::Option<
4160 unsafe extern "C" fn(
4161 user_data: *mut ::std::os::raw::c_void,
4162 window: ULWindow,
4163 width: ::std::os::raw::c_uint,
4164 height: ::std::os::raw::c_uint,
4165 ),
4166>;
4167extern "C" {
4168 #[doc = "\n Set a callback to be notified when a window resizes\n (parameters are passed back in pixels).\n"]
4169 pub fn ulWindowSetResizeCallback(
4170 window: ULWindow,
4171 callback: ULResizeCallback,
4172 user_data: *mut ::std::os::raw::c_void,
4173 );
4174}
4175extern "C" {
4176 #[doc = "\n Get window width (in screen coordinates).\n"]
4177 pub fn ulWindowGetScreenWidth(window: ULWindow) -> ::std::os::raw::c_uint;
4178}
4179extern "C" {
4180 #[doc = "\n Get window width (in pixels).\n"]
4181 pub fn ulWindowGetWidth(window: ULWindow) -> ::std::os::raw::c_uint;
4182}
4183extern "C" {
4184 #[doc = "\n Get window height (in screen coordinates).\n"]
4185 pub fn ulWindowGetScreenHeight(window: ULWindow) -> ::std::os::raw::c_uint;
4186}
4187extern "C" {
4188 #[doc = "\n Get window height (in pixels).\n"]
4189 pub fn ulWindowGetHeight(window: ULWindow) -> ::std::os::raw::c_uint;
4190}
4191extern "C" {
4192 #[doc = "\n Move the window to a new position (in screen coordinates) relative to the top-left of the\n monitor area.\n"]
4193 pub fn ulWindowMoveTo(window: ULWindow, x: ::std::os::raw::c_int, y: ::std::os::raw::c_int);
4194}
4195extern "C" {
4196 #[doc = "\n Move the window to the center of the monitor.\n"]
4197 pub fn ulWindowMoveToCenter(arg1: ULWindow);
4198}
4199extern "C" {
4200 #[doc = "\n Get the x-position of the window (in screen coordinates) relative to the top-left of the\n monitor area.\n"]
4201 pub fn ulWindowGetPositionX(window: ULWindow) -> ::std::os::raw::c_int;
4202}
4203extern "C" {
4204 #[doc = "\n Get the y-position of the window (in screen coordinates) relative to the top-left of the\n monitor area.\n"]
4205 pub fn ulWindowGetPositionY(window: ULWindow) -> ::std::os::raw::c_int;
4206}
4207extern "C" {
4208 #[doc = "\n Get whether or not a window is fullscreen.\n"]
4209 pub fn ulWindowIsFullscreen(window: ULWindow) -> bool;
4210}
4211extern "C" {
4212 #[doc = "\n Get the DPI scale of a window.\n"]
4213 pub fn ulWindowGetScale(window: ULWindow) -> f64;
4214}
4215extern "C" {
4216 #[doc = "\n Set the window title.\n"]
4217 pub fn ulWindowSetTitle(window: ULWindow, title: *const ::std::os::raw::c_char);
4218}
4219extern "C" {
4220 #[doc = "\n Set the cursor for a window.\n"]
4221 pub fn ulWindowSetCursor(window: ULWindow, cursor: ULCursor);
4222}
4223extern "C" {
4224 #[doc = "\n Show the window (if it was previously hidden).\n"]
4225 pub fn ulWindowShow(window: ULWindow);
4226}
4227extern "C" {
4228 #[doc = "\n Hide the window.\n"]
4229 pub fn ulWindowHide(window: ULWindow);
4230}
4231extern "C" {
4232 #[doc = "\n Whether or not the window is currently visible (not hidden).\n"]
4233 pub fn ulWindowIsVisible(window: ULWindow) -> bool;
4234}
4235extern "C" {
4236 #[doc = "\n Close a window.\n"]
4237 pub fn ulWindowClose(window: ULWindow);
4238}
4239extern "C" {
4240 #[doc = "\n Convert screen coordinates to pixels using the current DPI scale.\n"]
4241 pub fn ulWindowScreenToPixels(
4242 window: ULWindow,
4243 val: ::std::os::raw::c_int,
4244 ) -> ::std::os::raw::c_int;
4245}
4246extern "C" {
4247 #[doc = "\n Convert pixels to screen coordinates using the current DPI scale.\n"]
4248 pub fn ulWindowPixelsToScreen(
4249 window: ULWindow,
4250 val: ::std::os::raw::c_int,
4251 ) -> ::std::os::raw::c_int;
4252}
4253extern "C" {
4254 #[doc = "\n Get the underlying native window handle.\n\n @note This is: - HWND on Windows\n - NSWindow* on macOS\n - GLFWwindow* on Linux\n"]
4255 pub fn ulWindowGetNativeHandle(window: ULWindow) -> *mut ::std::os::raw::c_void;
4256}
4257extern "C" {
4258 #[doc = "\n Create a new Overlay.\n\n @param window The window to create the Overlay in.\n\n @param width The width in pixels.\n\n @param height The height in pixels.\n\n @param x The x-position (offset from the left of the Window), in\n pixels.\n\n @param y The y-position (offset from the top of the Window), in\n pixels.\n\n @note Each Overlay is essentially a View and an on-screen quad. You should\n create the Overlay then load content into the underlying View.\n"]
4259 pub fn ulCreateOverlay(
4260 window: ULWindow,
4261 width: ::std::os::raw::c_uint,
4262 height: ::std::os::raw::c_uint,
4263 x: ::std::os::raw::c_int,
4264 y: ::std::os::raw::c_int,
4265 ) -> ULOverlay;
4266}
4267extern "C" {
4268 #[doc = "\n Create a new Overlay, wrapping an existing View.\n\n @param window The window to create the Overlay in. (we currently only\n support one window per application)\n\n @param view The View to wrap (will use its width and height).\n\n @param x The x-position (offset from the left of the Window), in\n pixels.\n\n @param y The y-position (offset from the top of the Window), in\n pixels.\n\n @note Each Overlay is essentially a View and an on-screen quad. You should\n create the Overlay then load content into the underlying View.\n"]
4269 pub fn ulCreateOverlayWithView(
4270 window: ULWindow,
4271 view: ULView,
4272 x: ::std::os::raw::c_int,
4273 y: ::std::os::raw::c_int,
4274 ) -> ULOverlay;
4275}
4276extern "C" {
4277 #[doc = "\n Destroy an overlay.\n"]
4278 pub fn ulDestroyOverlay(overlay: ULOverlay);
4279}
4280extern "C" {
4281 #[doc = "\n Get the underlying View.\n"]
4282 pub fn ulOverlayGetView(overlay: ULOverlay) -> ULView;
4283}
4284extern "C" {
4285 #[doc = "\n Get the width (in pixels).\n"]
4286 pub fn ulOverlayGetWidth(overlay: ULOverlay) -> ::std::os::raw::c_uint;
4287}
4288extern "C" {
4289 #[doc = "\n Get the height (in pixels).\n"]
4290 pub fn ulOverlayGetHeight(overlay: ULOverlay) -> ::std::os::raw::c_uint;
4291}
4292extern "C" {
4293 #[doc = "\n Get the x-position (offset from the left of the Window), in pixels.\n"]
4294 pub fn ulOverlayGetX(overlay: ULOverlay) -> ::std::os::raw::c_int;
4295}
4296extern "C" {
4297 #[doc = "\n Get the y-position (offset from the top of the Window), in pixels.\n"]
4298 pub fn ulOverlayGetY(overlay: ULOverlay) -> ::std::os::raw::c_int;
4299}
4300extern "C" {
4301 #[doc = "\n Move the overlay to a new position (in pixels).\n"]
4302 pub fn ulOverlayMoveTo(overlay: ULOverlay, x: ::std::os::raw::c_int, y: ::std::os::raw::c_int);
4303}
4304extern "C" {
4305 #[doc = "\n Resize the overlay (and underlying View), dimensions should be\n specified in pixels.\n"]
4306 pub fn ulOverlayResize(
4307 overlay: ULOverlay,
4308 width: ::std::os::raw::c_uint,
4309 height: ::std::os::raw::c_uint,
4310 );
4311}
4312extern "C" {
4313 #[doc = "\n Whether or not the overlay is hidden (not drawn).\n"]
4314 pub fn ulOverlayIsHidden(overlay: ULOverlay) -> bool;
4315}
4316extern "C" {
4317 #[doc = "\n Hide the overlay (will no longer be drawn).\n"]
4318 pub fn ulOverlayHide(overlay: ULOverlay);
4319}
4320extern "C" {
4321 #[doc = "\n Show the overlay.\n"]
4322 pub fn ulOverlayShow(overlay: ULOverlay);
4323}
4324extern "C" {
4325 #[doc = "\n Whether or not an overlay has keyboard focus.\n"]
4326 pub fn ulOverlayHasFocus(overlay: ULOverlay) -> bool;
4327}
4328extern "C" {
4329 #[doc = "\n Grant this overlay exclusive keyboard focus.\n"]
4330 pub fn ulOverlayFocus(overlay: ULOverlay);
4331}
4332extern "C" {
4333 #[doc = "\n Remove keyboard focus.\n"]
4334 pub fn ulOverlayUnfocus(overlay: ULOverlay);
4335}
4336extern "C" {
4337 #[doc = "\n This is only needed if you are not calling ulCreateApp().\n\n Initializes the platform font loader and sets it as the current FontLoader.\n"]
4338 pub fn ulEnablePlatformFontLoader();
4339}
4340extern "C" {
4341 #[doc = "\n This is only needed if you are not calling ulCreateApp().\n\n Initializes the platform file system (needed for loading file:/// URLs) and\n sets it as the current FileSystem.\n\n You can specify a base directory path to resolve relative paths against.\n"]
4342 pub fn ulEnablePlatformFileSystem(base_dir: ULString);
4343}
4344extern "C" {
4345 #[doc = "\n This is only needed if you are not calling ulCreateApp().\n\n Initializes the default logger (writes the log to a file).\n\n You should specify a writable log path to write the log to\n for example \"./ultralight.log\".\n"]
4346 pub fn ulEnableDefaultLogger(log_path: ULString);
4347}