Skip to main content

sdl3_sys/generated/
stdinc.rs

1//! SDL provides its own implementation of some of the most important C runtime
2//! functions.
3//!
4//! Using these functions allows an app to have access to common C
5//! functionality without depending on a specific C runtime (or a C runtime at
6//! all). More importantly, the SDL implementations work identically across
7//! platforms, so apps can avoid surprises like snprintf() behaving differently
8//! between Windows and Linux builds, or itoa() only existing on some
9//! platforms.
10//!
11//! For many of the most common functions, like [`SDL_memcpy`], SDL might just call
12//! through to the usual C runtime behind the scenes, if it makes sense to do
13//! so (if it's faster and always available/reliable on a given platform),
14//! reducing library size and offering the most optimized option.
15//!
16//! SDL also offers other C-runtime-adjacent functionality in this header that
17//! either isn't, strictly speaking, part of any C runtime standards, like
18//! [`SDL_crc32()`] and [`SDL_reinterpret_cast`], etc. It also offers a few better
19//! options, like [`SDL_strlcpy()`], which functions as a safer form of strcpy().
20
21apply_cfg!(#[cfg(doc)] => {
22    /// Don't let SDL use "long long" C types.
23    ///
24    /// SDL will define this if it believes the compiler doesn't understand the
25    /// "long long" syntax for C datatypes. This can happen on older compilers.
26    ///
27    /// If _your_ compiler doesn't support "long long" but SDL doesn't know it, it
28    /// is safe to define this yourself to build against the SDL headers.
29    ///
30    /// If this is defined, it will remove access to some C runtime support
31    /// functions, like [`SDL_ulltoa`] and [`SDL_strtoll`] that refer to this datatype
32    /// explicitly. The rest of SDL will still be available.
33    ///
34    /// SDL's own source code cannot be built with a compiler that has this
35    /// defined, for various technical reasons.
36    pub const SDL_NOLONGLONG: ::core::primitive::i32 = 1;
37
38});
39
40apply_cfg!(#[cfg(not(doc))] => {
41});
42
43apply_cfg!(#[cfg(doc)] => {
44    /// The largest value that a `size_t` can hold for the target platform.
45    ///
46    /// `size_t` is generally the same size as a pointer in modern times, but this
47    /// can get weird on very old and very esoteric machines. For example, on a
48    /// 16-bit Intel 286, you might have a 32-bit "far" pointer (16-bit segment
49    /// plus 16-bit offset), but `size_t` is 16 bits, because it can only deal with
50    /// the offset into an individual segment.
51    ///
52    /// In modern times, it's generally expected to cover an entire linear address
53    /// space. But be careful!
54    ///
55    /// ## Availability
56    /// This macro is available since SDL 3.2.0.
57    pub const SDL_SIZE_MAX: ::core::primitive::usize = ::core::primitive::usize::MAX;
58
59});
60
61apply_cfg!(#[cfg(not(doc))] => {
62    pub const SDL_SIZE_MAX: ::core::primitive::usize = ::core::primitive::usize::MAX;
63
64});
65
66apply_cfg!(#[cfg(doc)] => {
67});
68
69apply_cfg!(#[cfg(not(doc))] => {
70});
71
72apply_cfg!(#[cfg(doc)] => {
73});
74
75apply_cfg!(#[cfg(not(doc))] => {
76});
77
78apply_cfg!(#[cfg(doc)] => {
79});
80
81apply_cfg!(#[cfg(not(doc))] => {
82});
83
84/// A signed 8-bit integer type.
85///
86/// ## Availability
87/// This macro is available since SDL 3.2.0.
88pub type Sint8 = ::core::primitive::i8;
89
90pub const SDL_MAX_SINT8: Sint8 = (0x7f as Sint8);
91
92pub const SDL_MIN_SINT8: Sint8 = ((-128_i32) as Sint8);
93
94/// An unsigned 8-bit integer type.
95///
96/// ## Availability
97/// This macro is available since SDL 3.2.0.
98pub type Uint8 = ::core::primitive::u8;
99
100pub const SDL_MAX_UINT8: Uint8 = (0xff as Uint8);
101
102pub const SDL_MIN_UINT8: Uint8 = (0x00 as Uint8);
103
104/// A signed 16-bit integer type.
105///
106/// ## Availability
107/// This macro is available since SDL 3.2.0.
108pub type Sint16 = ::core::primitive::i16;
109
110pub const SDL_MAX_SINT16: Sint16 = (0x7fff as Sint16);
111
112pub const SDL_MIN_SINT16: Sint16 = ((-32768_i32) as Sint16);
113
114/// An unsigned 16-bit integer type.
115///
116/// ## Availability
117/// This macro is available since SDL 3.2.0.
118pub type Uint16 = ::core::primitive::u16;
119
120pub const SDL_MAX_UINT16: Uint16 = (0xffff as Uint16);
121
122pub const SDL_MIN_UINT16: Uint16 = (0x0000 as Uint16);
123
124/// A signed 32-bit integer type.
125///
126/// ## Availability
127/// This macro is available since SDL 3.2.0.
128pub type Sint32 = ::core::primitive::i32;
129
130pub const SDL_MAX_SINT32: Sint32 = (0x7fffffff as Sint32);
131
132pub const SDL_MIN_SINT32: Sint32 = ((-2147483648_i32) as Sint32);
133
134/// An unsigned 32-bit integer type.
135///
136/// ## Availability
137/// This macro is available since SDL 3.2.0.
138pub type Uint32 = ::core::primitive::u32;
139
140pub const SDL_MAX_UINT32: Uint32 = (0xffffffff as Uint32);
141
142pub const SDL_MIN_UINT32: Uint32 = (0x00000000 as Uint32);
143
144/// A signed 64-bit integer type.
145///
146/// ## Availability
147/// This macro is available since SDL 3.2.0.
148///
149/// ## See also
150/// - SDL_SINT64_C
151pub type Sint64 = ::core::primitive::i64;
152
153pub const SDL_MAX_SINT64: ::core::primitive::i64 = 9223372036854775807_i64;
154
155pub const SDL_MIN_SINT64: ::core::primitive::i64 = -9223372036854775808_i64;
156
157/// An unsigned 64-bit integer type.
158///
159/// ## Availability
160/// This macro is available since SDL 3.2.0.
161///
162/// ## See also
163/// - SDL_UINT64_C
164pub type Uint64 = ::core::primitive::u64;
165
166pub const SDL_MAX_UINT64: ::core::primitive::u64 = 18446744073709551615_u64;
167
168pub const SDL_MIN_UINT64: ::core::primitive::u64 = 0_u64;
169
170/// SDL times are signed, 64-bit integers representing nanoseconds since the
171/// Unix epoch (Jan 1, 1970).
172///
173/// They can be converted between POSIX time_t values with [`SDL_NS_TO_SECONDS()`]
174/// and [`SDL_SECONDS_TO_NS()`], and between Windows FILETIME values with
175/// [`SDL_TimeToWindows()`] and [`SDL_TimeFromWindows()`].
176///
177/// ## Availability
178/// This datatype is available since SDL 3.2.0.
179///
180/// ## See also
181/// - [`SDL_MAX_SINT64`]
182/// - [`SDL_MIN_SINT64`]
183pub type SDL_Time = Sint64;
184
185pub const SDL_MAX_TIME: ::core::primitive::i64 = SDL_MAX_SINT64;
186
187pub const SDL_MIN_TIME: ::core::primitive::i64 = SDL_MIN_SINT64;
188
189pub const SDL_FLT_EPSILON: ::core::ffi::c_float = ::core::primitive::f32::EPSILON;
190
191apply_cfg!(#[cfg(doc)] => {
192    /// A printf-formatting string for an Sint64 value.
193    ///
194    /// Use it like this:
195    ///
196    /// ```c
197    /// SDL_Log("There are %" SDL_PRIs64 " bottles of beer on the wall.", bottles);
198    /// ```
199    ///
200    /// ## Availability
201    /// This macro is available since SDL 3.2.0.
202    pub const SDL_PRIs64: *const ::core::ffi::c_char = c"lld".as_ptr();
203
204    /// A printf-formatting string for a Uint64 value.
205    ///
206    /// Use it like this:
207    ///
208    /// ```c
209    /// SDL_Log("There are %" SDL_PRIu64 " bottles of beer on the wall.", bottles);
210    /// ```
211    ///
212    /// ## Availability
213    /// This macro is available since SDL 3.2.0.
214    pub const SDL_PRIu64: *const ::core::ffi::c_char = c"llu".as_ptr();
215
216    /// A printf-formatting string for a Uint64 value as lower-case hexadecimal.
217    ///
218    /// Use it like this:
219    ///
220    /// ```c
221    /// SDL_Log("There are %" SDL_PRIx64 " bottles of beer on the wall.", bottles);
222    /// ```
223    ///
224    /// ## Availability
225    /// This macro is available since SDL 3.2.0.
226    pub const SDL_PRIx64: *const ::core::ffi::c_char = c"llx".as_ptr();
227
228    /// A printf-formatting string for a Uint64 value as upper-case hexadecimal.
229    ///
230    /// Use it like this:
231    ///
232    /// ```c
233    /// SDL_Log("There are %" SDL_PRIX64 " bottles of beer on the wall.", bottles);
234    /// ```
235    ///
236    /// ## Availability
237    /// This macro is available since SDL 3.2.0.
238    pub const SDL_PRIX64: *const ::core::ffi::c_char = c"llX".as_ptr();
239
240    /// A printf-formatting string for an Sint32 value.
241    ///
242    /// Use it like this:
243    ///
244    /// ```c
245    /// SDL_Log("There are %" SDL_PRIs32 " bottles of beer on the wall.", bottles);
246    /// ```
247    ///
248    /// ## Availability
249    /// This macro is available since SDL 3.2.0.
250    pub const SDL_PRIs32: *const ::core::ffi::c_char = c"d".as_ptr();
251
252    /// A printf-formatting string for a Uint32 value.
253    ///
254    /// Use it like this:
255    ///
256    /// ```c
257    /// SDL_Log("There are %" SDL_PRIu32 " bottles of beer on the wall.", bottles);
258    /// ```
259    ///
260    /// ## Availability
261    /// This macro is available since SDL 3.2.0.
262    pub const SDL_PRIu32: *const ::core::ffi::c_char = c"u".as_ptr();
263
264    /// A printf-formatting string for a Uint32 value as lower-case hexadecimal.
265    ///
266    /// Use it like this:
267    ///
268    /// ```c
269    /// SDL_Log("There are %" SDL_PRIx32 " bottles of beer on the wall.", bottles);
270    /// ```
271    ///
272    /// ## Availability
273    /// This macro is available since SDL 3.2.0.
274    pub const SDL_PRIx32: *const ::core::ffi::c_char = c"x".as_ptr();
275
276    /// A printf-formatting string for a Uint32 value as upper-case hexadecimal.
277    ///
278    /// Use it like this:
279    ///
280    /// ```c
281    /// SDL_Log("There are %" SDL_PRIX32 " bottles of beer on the wall.", bottles);
282    /// ```
283    ///
284    /// ## Availability
285    /// This macro is available since SDL 3.2.0.
286    pub const SDL_PRIX32: *const ::core::ffi::c_char = c"X".as_ptr();
287
288    /// A printf-formatting string prefix for a `long long` value.
289    ///
290    /// This is just the prefix! You probably actually want [`SDL_PRILLd`], [`SDL_PRILLu`],
291    /// [`SDL_PRILLx`], or [`SDL_PRILLX`] instead.
292    ///
293    /// Use it like this:
294    ///
295    /// ```c
296    /// SDL_Log("There are %" SDL_PRILL_PREFIX "d bottles of beer on the wall.", bottles);
297    /// ```
298    ///
299    /// ## Availability
300    /// This macro is available since SDL 3.2.0.
301    pub const SDL_PRILL_PREFIX: *const ::core::ffi::c_char = c"ll".as_ptr();
302
303    /// A printf-formatting string for a `long long` value.
304    ///
305    /// Use it like this:
306    ///
307    /// ```c
308    /// SDL_Log("There are %" SDL_PRILLd " bottles of beer on the wall.", bottles);
309    /// ```
310    ///
311    /// ## Availability
312    /// This macro is available since SDL 3.2.0.
313    pub const SDL_PRILLd: *const ::core::ffi::c_char = c"lld".as_ptr();
314
315    /// A printf-formatting string for a `unsigned long long` value.
316    ///
317    /// Use it like this:
318    ///
319    /// ```c
320    /// SDL_Log("There are %" SDL_PRILLu " bottles of beer on the wall.", bottles);
321    /// ```
322    ///
323    /// ## Availability
324    /// This macro is available since SDL 3.2.0.
325    pub const SDL_PRILLu: *const ::core::ffi::c_char = c"llu".as_ptr();
326
327    /// A printf-formatting string for an `unsigned long long` value as lower-case
328    /// hexadecimal.
329    ///
330    /// Use it like this:
331    ///
332    /// ```c
333    /// SDL_Log("There are %" SDL_PRILLx " bottles of beer on the wall.", bottles);
334    /// ```
335    ///
336    /// ## Availability
337    /// This macro is available since SDL 3.2.0.
338    pub const SDL_PRILLx: *const ::core::ffi::c_char = c"llx".as_ptr();
339
340    /// A printf-formatting string for an `unsigned long long` value as upper-case
341    /// hexadecimal.
342    ///
343    /// Use it like this:
344    ///
345    /// ```c
346    /// SDL_Log("There are %" SDL_PRILLX " bottles of beer on the wall.", bottles);
347    /// ```
348    ///
349    /// ## Availability
350    /// This macro is available since SDL 3.2.0.
351    pub const SDL_PRILLX: *const ::core::ffi::c_char = c"llX".as_ptr();
352
353});
354
355apply_cfg!(#[cfg(any(doc, windows))] => {
356    #[cfg(not(doc))]
357    pub const SDL_PRIs64: *const ::core::ffi::c_char = c"I64d".as_ptr();
358
359});
360
361apply_cfg!(#[cfg(not(any(doc, windows)))] => {
362    apply_cfg!(#[cfg(all(not(any(doc, target_vendor = "apple")), not(target_os = "emscripten"), all(not(windows), target_pointer_width = "64")))] => {
363        #[cfg(not(doc))]
364        pub const SDL_PRIs64: *const ::core::ffi::c_char = c"ld".as_ptr();
365
366    });
367
368    apply_cfg!(#[cfg(not(all(not(any(doc, target_vendor = "apple")), not(target_os = "emscripten"), all(not(windows), target_pointer_width = "64"))))] => {
369        #[cfg(not(doc))]
370        pub const SDL_PRIs64: *const ::core::ffi::c_char = c"lld".as_ptr();
371
372    });
373
374});
375
376apply_cfg!(#[cfg(any(doc, windows))] => {
377    #[cfg(not(doc))]
378    pub const SDL_PRIu64: *const ::core::ffi::c_char = c"I64u".as_ptr();
379
380});
381
382apply_cfg!(#[cfg(not(any(doc, windows)))] => {
383    apply_cfg!(#[cfg(all(not(any(doc, target_vendor = "apple")), not(target_os = "emscripten"), all(not(windows), target_pointer_width = "64")))] => {
384        #[cfg(not(doc))]
385        pub const SDL_PRIu64: *const ::core::ffi::c_char = c"lu".as_ptr();
386
387    });
388
389    apply_cfg!(#[cfg(not(all(not(any(doc, target_vendor = "apple")), not(target_os = "emscripten"), all(not(windows), target_pointer_width = "64"))))] => {
390        #[cfg(not(doc))]
391        pub const SDL_PRIu64: *const ::core::ffi::c_char = c"llu".as_ptr();
392
393    });
394
395});
396
397apply_cfg!(#[cfg(any(doc, windows))] => {
398    #[cfg(not(doc))]
399    pub const SDL_PRIx64: *const ::core::ffi::c_char = c"I64x".as_ptr();
400
401});
402
403apply_cfg!(#[cfg(not(any(doc, windows)))] => {
404    apply_cfg!(#[cfg(all(not(any(doc, target_vendor = "apple")), all(not(windows), target_pointer_width = "64")))] => {
405        #[cfg(not(doc))]
406        pub const SDL_PRIx64: *const ::core::ffi::c_char = c"lx".as_ptr();
407
408    });
409
410    apply_cfg!(#[cfg(not(all(not(any(doc, target_vendor = "apple")), all(not(windows), target_pointer_width = "64"))))] => {
411        #[cfg(not(doc))]
412        pub const SDL_PRIx64: *const ::core::ffi::c_char = c"llx".as_ptr();
413
414    });
415
416});
417
418apply_cfg!(#[cfg(any(doc, windows))] => {
419    #[cfg(not(doc))]
420    pub const SDL_PRIX64: *const ::core::ffi::c_char = c"I64X".as_ptr();
421
422});
423
424apply_cfg!(#[cfg(not(any(doc, windows)))] => {
425    apply_cfg!(#[cfg(all(not(any(doc, target_vendor = "apple")), all(not(windows), target_pointer_width = "64")))] => {
426        #[cfg(not(doc))]
427        pub const SDL_PRIX64: *const ::core::ffi::c_char = c"lX".as_ptr();
428
429    });
430
431    apply_cfg!(#[cfg(not(all(not(any(doc, target_vendor = "apple")), all(not(windows), target_pointer_width = "64"))))] => {
432        #[cfg(not(doc))]
433        pub const SDL_PRIX64: *const ::core::ffi::c_char = c"llX".as_ptr();
434
435    });
436
437});
438
439#[cfg(not(doc))]
440pub const SDL_PRIs32: *const ::core::ffi::c_char = c"d".as_ptr();
441
442#[cfg(not(doc))]
443pub const SDL_PRIu32: *const ::core::ffi::c_char = c"u".as_ptr();
444
445#[cfg(not(doc))]
446pub const SDL_PRIx32: *const ::core::ffi::c_char = c"x".as_ptr();
447
448#[cfg(not(doc))]
449pub const SDL_PRIX32: *const ::core::ffi::c_char = c"X".as_ptr();
450
451apply_cfg!(#[cfg(any(doc, windows))] => {
452    const _: () = ::core::assert!((::core::mem::size_of::<::core::ffi::c_longlong>() == 8_usize));
453
454    #[cfg(not(doc))]
455    pub const SDL_PRILL_PREFIX: *const ::core::ffi::c_char = c"I64".as_ptr();
456
457    #[cfg(not(doc))]
458    pub const SDL_PRILLd: *const ::core::ffi::c_char = c"I64d".as_ptr();
459
460    #[cfg(not(doc))]
461    pub const SDL_PRILLu: *const ::core::ffi::c_char = c"I64u".as_ptr();
462
463    #[cfg(not(doc))]
464    pub const SDL_PRILLx: *const ::core::ffi::c_char = c"I64x".as_ptr();
465
466    #[cfg(not(doc))]
467    pub const SDL_PRILLX: *const ::core::ffi::c_char = c"I64X".as_ptr();
468
469});
470
471apply_cfg!(#[cfg(not(any(doc, windows)))] => {
472    #[cfg(not(doc))]
473    pub const SDL_PRILL_PREFIX: *const ::core::ffi::c_char = c"ll".as_ptr();
474
475    #[cfg(not(doc))]
476    pub const SDL_PRILLd: *const ::core::ffi::c_char = c"lld".as_ptr();
477
478    #[cfg(not(doc))]
479    pub const SDL_PRILLu: *const ::core::ffi::c_char = c"llu".as_ptr();
480
481    #[cfg(not(doc))]
482    pub const SDL_PRILLx: *const ::core::ffi::c_char = c"llx".as_ptr();
483
484    #[cfg(not(doc))]
485    pub const SDL_PRILLX: *const ::core::ffi::c_char = c"llX".as_ptr();
486
487});
488
489apply_cfg!(#[cfg(doc)] => {
490});
491
492apply_cfg!(#[cfg(not(doc))] => {
493});
494
495const _: () = ::core::assert!((::core::mem::size_of::<::core::primitive::bool>() == 1_usize));
496
497const _: () = ::core::assert!((::core::mem::size_of::<Uint8>() == 1_usize));
498
499const _: () = ::core::assert!((::core::mem::size_of::<Sint8>() == 1_usize));
500
501const _: () = ::core::assert!((::core::mem::size_of::<Uint16>() == 2_usize));
502
503const _: () = ::core::assert!((::core::mem::size_of::<Sint16>() == 2_usize));
504
505const _: () = ::core::assert!((::core::mem::size_of::<Uint32>() == 4_usize));
506
507const _: () = ::core::assert!((::core::mem::size_of::<Sint32>() == 4_usize));
508
509const _: () = ::core::assert!((::core::mem::size_of::<Uint64>() == 8_usize));
510
511const _: () = ::core::assert!((::core::mem::size_of::<Sint64>() == 8_usize));
512
513const _: () = ::core::assert!(
514    (::core::mem::size_of::<Uint64>() <= ::core::mem::size_of::<::core::ffi::c_ulonglong>())
515);
516
517const _: () = ::core::assert!(
518    (::core::mem::size_of::<::core::primitive::usize>()
519        <= ::core::mem::size_of::<::core::ffi::c_ulonglong>())
520);
521
522/// Define a four character code as a Uint32.
523///
524/// ## Parameters
525/// - `A`: the first ASCII character.
526/// - `B`: the second ASCII character.
527/// - `C`: the third ASCII character.
528/// - `D`: the fourth ASCII character.
529///
530/// ## Return value
531/// Returns the four characters converted into a Uint32, one character
532///   per-byte.
533///
534/// ## Thread safety
535/// It is safe to call this macro from any thread.
536///
537/// ## Availability
538/// This macro is available since SDL 3.2.0.
539#[inline(always)]
540pub const fn SDL_FOURCC(A: Uint8, B: Uint8, C: Uint8, D: Uint8) -> Uint32 {
541    (((((A as Uint32) << 0) | ((B as Uint32) << 8)) | ((C as Uint32) << 16))
542        | ((D as Uint32) << 24))
543}
544
545#[doc(hidden)]
546#[repr(C)]
547#[cfg_attr(feature = "debug-impls", derive(Debug))]
548pub struct SDL_alignment_test {
549    pub a: Uint8,
550    pub b: *mut ::core::ffi::c_void,
551}
552
553impl ::core::default::Default for SDL_alignment_test {
554    /// Initialize all fields to zero
555    #[inline(always)]
556    fn default() -> Self {
557        unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
558    }
559}
560
561const _: () = ::core::assert!(
562    (::core::mem::size_of::<SDL_alignment_test>()
563        == (2 * ::core::mem::size_of::<*mut ::core::ffi::c_void>()))
564);
565
566const _: () = ::core::assert!((!(0 as ::core::ffi::c_int) == (-1_i32 as ::core::ffi::c_int)));
567
568apply_cfg!(#[cfg(all(not(any(doc, target_os = "horizon")), not(any(doc, target_os = "vita"))))] => {
569    #[doc(hidden)]
570    /// ## Known values (`sdl3-sys`)
571    /// | Associated constant | Global constant | Description |
572    /// | ------------------- | --------------- | ----------- |
573    /// | [`DUMMY_ENUM_VALUE`](SDL_DUMMY_ENUM::DUMMY_ENUM_VALUE) | [`DUMMY_ENUM_VALUE`] | |
574    #[repr(transparent)]
575    #[derive(Clone, Copy)]
576    #[derive(Default)]
577    #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
578    pub struct SDL_DUMMY_ENUM(pub ::core::ffi::c_int);
579
580    impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_DUMMY_ENUM {
581        #[inline(always)]
582        fn eq(&self, other: &::core::ffi::c_int) -> bool {
583            &self.0 == other
584        }
585    }
586
587    impl ::core::cmp::PartialEq<SDL_DUMMY_ENUM> for ::core::ffi::c_int {
588        #[inline(always)]
589        fn eq(&self, other: &SDL_DUMMY_ENUM) -> bool {
590            self == &other.0
591        }
592    }
593
594    impl From<SDL_DUMMY_ENUM> for ::core::ffi::c_int {
595        #[inline(always)]
596        fn from(value: SDL_DUMMY_ENUM) -> Self {
597            value.0
598        }
599    }
600
601    #[cfg(feature = "debug-impls")]
602    impl ::core::fmt::Debug for SDL_DUMMY_ENUM {
603        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
604            #[allow(unreachable_patterns)]
605            f.write_str(match *self {
606                Self::DUMMY_ENUM_VALUE => "DUMMY_ENUM_VALUE",
607
608                _ => return write!(f, "SDL_DUMMY_ENUM({})", self.0),
609            })
610        }
611    }
612
613    impl SDL_DUMMY_ENUM {
614        pub const DUMMY_ENUM_VALUE: Self = Self((0 as ::core::ffi::c_int));
615    }
616
617    #[doc(hidden)]
618    pub const DUMMY_ENUM_VALUE: SDL_DUMMY_ENUM = SDL_DUMMY_ENUM::DUMMY_ENUM_VALUE;
619
620    impl SDL_DUMMY_ENUM {
621        /// Initialize a `SDL_DUMMY_ENUM` from a raw value.
622        #[inline(always)]
623        pub const fn new(value: ::core::ffi::c_int) -> Self {
624            Self(value)
625        }
626    }
627
628    impl SDL_DUMMY_ENUM {
629        /// Get a copy of the inner raw value.
630        #[inline(always)]
631        pub const fn value(&self) -> ::core::ffi::c_int {
632            self.0
633        }
634    }
635
636    const _: () = ::core::assert!((::core::mem::size_of::<SDL_DUMMY_ENUM>() == ::core::mem::size_of::<::core::ffi::c_int>()));
637
638});
639
640/// A macro to initialize an SDL interface.
641///
642/// This macro will initialize an SDL interface structure and should be called
643/// before you fill out the fields with your implementation.
644///
645/// You can use it like this:
646///
647/// ```c
648/// SDL_IOStreamInterface iface;
649///
650/// SDL_INIT_INTERFACE(&iface);
651///
652/// // Fill in the interface function pointers with your implementation
653/// iface.seek = ...
654///
655/// stream = SDL_OpenIO(&iface, NULL);
656/// ```
657///
658/// If you are using designated initializers, you can use the size of the
659/// interface as the version, e.g.
660///
661/// ```c
662/// SDL_IOStreamInterface iface = {
663///     .version = sizeof(iface),
664///     .seek = ...
665/// };
666/// stream = SDL_OpenIO(&iface, NULL);
667/// ```
668///
669/// ## Thread safety
670/// It is safe to call this macro from any thread.
671///
672/// ## Availability
673/// This macro is available since SDL 3.2.0.
674///
675/// ## See also
676/// - [`SDL_IOStreamInterface`]
677/// - [`SDL_StorageInterface`]
678/// - [`SDL_VirtualJoystickDesc`]
679///
680/// ## Safety (`sdl3-sys`)
681/// - `iface` must point to memory that is valid for writing the type `T`.
682/// - The type `T` must be a `repr(C)` struct.
683/// - The first field of the struct must be of type `u32`. It will be set to
684///   the size of the struct in bytes.
685/// - The rest of the struct will be initialized as all zero bytes.
686#[inline(always)]
687pub unsafe fn SDL_INIT_INTERFACE<T>(iface: *mut T) {
688    const { ::core::assert!(::core::mem::size_of::<T>() <= ::core::primitive::u32::MAX as usize) };
689    unsafe {
690        iface.write_bytes(0, 1);
691        iface
692            .cast::<Uint32>()
693            .write(::core::mem::size_of::<T>() as Uint32);
694    }
695}
696
697apply_cfg!(#[cfg(doc)] => {
698});
699
700apply_cfg!(#[cfg(not(doc))] => {
701});
702
703unsafe extern "C" {
704    /// Allocate uninitialized memory.
705    ///
706    /// The allocated memory returned by this function must be freed with
707    /// [`SDL_free()`].
708    ///
709    /// If `size` is 0, it will be set to 1.
710    ///
711    /// If the allocation is successful, the returned pointer is guaranteed to be
712    /// aligned to either the *fundamental alignment* (`alignof(max_align_t)` in
713    /// C11 and later) or `2 * sizeof(void *)`, whichever is smaller. Use
714    /// [`SDL_aligned_alloc()`] if you need to allocate memory aligned to an alignment
715    /// greater than this guarantee.
716    ///
717    /// ## Parameters
718    /// - `size`: the size to allocate.
719    ///
720    /// ## Return value
721    /// Returns a pointer to the allocated memory, or NULL if allocation failed.
722    ///
723    /// ## Thread safety
724    /// It is safe to call this function from any thread.
725    ///
726    /// ## Availability
727    /// This function is available since SDL 3.2.0.
728    ///
729    /// ## See also
730    /// - [`SDL_free`]
731    /// - [`SDL_calloc`]
732    /// - [`SDL_realloc`]
733    /// - [`SDL_aligned_alloc`]
734    pub fn SDL_malloc(size: ::core::primitive::usize) -> *mut ::core::ffi::c_void;
735}
736
737unsafe extern "C" {
738    /// Allocate a zero-initialized array.
739    ///
740    /// The memory returned by this function must be freed with [`SDL_free()`].
741    ///
742    /// If either of `nmemb` or `size` is 0, they will both be set to 1.
743    ///
744    /// If the allocation is successful, the returned pointer is guaranteed to be
745    /// aligned to either the *fundamental alignment* (`alignof(max_align_t)` in
746    /// C11 and later) or `2 * sizeof(void *)`, whichever is smaller.
747    ///
748    /// ## Parameters
749    /// - `nmemb`: the number of elements in the array.
750    /// - `size`: the size of each element of the array.
751    ///
752    /// ## Return value
753    /// Returns a pointer to the allocated array, or NULL if allocation failed.
754    ///
755    /// ## Thread safety
756    /// It is safe to call this function from any thread.
757    ///
758    /// ## Availability
759    /// This function is available since SDL 3.2.0.
760    ///
761    /// ## See also
762    /// - [`SDL_free`]
763    /// - [`SDL_malloc`]
764    /// - [`SDL_realloc`]
765    pub fn SDL_calloc(
766        nmemb: ::core::primitive::usize,
767        size: ::core::primitive::usize,
768    ) -> *mut ::core::ffi::c_void;
769}
770
771unsafe extern "C" {
772    /// Change the size of allocated memory.
773    ///
774    /// The memory returned by this function must be freed with [`SDL_free()`].
775    ///
776    /// If `size` is 0, it will be set to 1. Note that this is unlike some other C
777    /// runtime `realloc` implementations, which may treat `realloc(mem, 0)` the
778    /// same way as `free(mem)`.
779    ///
780    /// If `mem` is NULL, the behavior of this function is equivalent to
781    /// [`SDL_malloc()`]. Otherwise, the function can have one of three possible
782    /// outcomes:
783    ///
784    /// - If it returns the same pointer as `mem`, it means that `mem` was resized
785    ///   in place without freeing.
786    /// - If it returns a different non-NULL pointer, it means that `mem` was freed
787    ///   and cannot be dereferenced anymore.
788    /// - If it returns NULL (indicating failure), then `mem` will remain valid and
789    ///   must still be freed with [`SDL_free()`].
790    ///
791    /// If the allocation is successfully resized, the returned pointer is
792    /// guaranteed to be aligned to either the *fundamental alignment*
793    /// (`alignof(max_align_t)` in C11 and later) or `2 * sizeof(void *)`,
794    /// whichever is smaller.
795    ///
796    /// ## Parameters
797    /// - `mem`: a pointer to allocated memory to reallocate, or NULL.
798    /// - `size`: the new size of the memory.
799    ///
800    /// ## Return value
801    /// Returns a pointer to the newly allocated memory, or NULL if allocation
802    ///   failed.
803    ///
804    /// ## Thread safety
805    /// It is safe to call this function from any thread.
806    ///
807    /// ## Availability
808    /// This function is available since SDL 3.2.0.
809    ///
810    /// ## See also
811    /// - [`SDL_free`]
812    /// - [`SDL_malloc`]
813    /// - [`SDL_calloc`]
814    pub fn SDL_realloc(
815        mem: *mut ::core::ffi::c_void,
816        size: ::core::primitive::usize,
817    ) -> *mut ::core::ffi::c_void;
818}
819
820unsafe extern "C" {
821    /// Free allocated memory.
822    ///
823    /// The pointer is no longer valid after this call and cannot be dereferenced
824    /// anymore.
825    ///
826    /// If `mem` is NULL, this function does nothing.
827    ///
828    /// ## Parameters
829    /// - `mem`: a pointer to allocated memory, or NULL.
830    ///
831    /// ## Thread safety
832    /// It is safe to call this function from any thread.
833    ///
834    /// ## Availability
835    /// This function is available since SDL 3.2.0.
836    ///
837    /// ## See also
838    /// - [`SDL_malloc`]
839    /// - [`SDL_calloc`]
840    /// - [`SDL_realloc`]
841    pub fn SDL_free(mem: *mut ::core::ffi::c_void);
842}
843
844/// A callback used to implement [`SDL_malloc()`].
845///
846/// SDL will always ensure that the passed `size` is greater than 0.
847///
848/// ## Parameters
849/// - `size`: the size to allocate.
850///
851/// ## Return value
852/// Returns a pointer to the allocated memory, or NULL if allocation failed.
853///
854/// ## Thread safety
855/// It should be safe to call this callback from any thread.
856///
857/// ## Availability
858/// This datatype is available since SDL 3.2.0.
859///
860/// ## See also
861/// - [`SDL_malloc`]
862/// - [`SDL_GetOriginalMemoryFunctions`]
863/// - [`SDL_GetMemoryFunctions`]
864/// - [`SDL_SetMemoryFunctions`]
865pub type SDL_malloc_func = ::core::option::Option<
866    unsafe extern "C" fn(size: ::core::primitive::usize) -> *mut ::core::ffi::c_void,
867>;
868
869/// A callback used to implement [`SDL_calloc()`].
870///
871/// SDL will always ensure that the passed `nmemb` and `size` are both greater
872/// than 0.
873///
874/// ## Parameters
875/// - `nmemb`: the number of elements in the array.
876/// - `size`: the size of each element of the array.
877///
878/// ## Return value
879/// Returns a pointer to the allocated array, or NULL if allocation failed.
880///
881/// ## Thread safety
882/// It should be safe to call this callback from any thread.
883///
884/// ## Availability
885/// This datatype is available since SDL 3.2.0.
886///
887/// ## See also
888/// - [`SDL_calloc`]
889/// - [`SDL_GetOriginalMemoryFunctions`]
890/// - [`SDL_GetMemoryFunctions`]
891/// - [`SDL_SetMemoryFunctions`]
892pub type SDL_calloc_func = ::core::option::Option<
893    unsafe extern "C" fn(
894        nmemb: ::core::primitive::usize,
895        size: ::core::primitive::usize,
896    ) -> *mut ::core::ffi::c_void,
897>;
898
899/// A callback used to implement [`SDL_realloc()`].
900///
901/// SDL will always ensure that the passed `size` is greater than 0.
902///
903/// ## Parameters
904/// - `mem`: a pointer to allocated memory to reallocate, or NULL.
905/// - `size`: the new size of the memory.
906///
907/// ## Return value
908/// Returns a pointer to the newly allocated memory, or NULL if allocation
909///   failed.
910///
911/// ## Thread safety
912/// It should be safe to call this callback from any thread.
913///
914/// ## Availability
915/// This datatype is available since SDL 3.2.0.
916///
917/// ## See also
918/// - [`SDL_realloc`]
919/// - [`SDL_GetOriginalMemoryFunctions`]
920/// - [`SDL_GetMemoryFunctions`]
921/// - [`SDL_SetMemoryFunctions`]
922pub type SDL_realloc_func = ::core::option::Option<
923    unsafe extern "C" fn(
924        mem: *mut ::core::ffi::c_void,
925        size: ::core::primitive::usize,
926    ) -> *mut ::core::ffi::c_void,
927>;
928
929/// A callback used to implement [`SDL_free()`].
930///
931/// SDL will always ensure that the passed `mem` is a non-NULL pointer.
932///
933/// ## Parameters
934/// - `mem`: a pointer to allocated memory.
935///
936/// ## Thread safety
937/// It should be safe to call this callback from any thread.
938///
939/// ## Availability
940/// This datatype is available since SDL 3.2.0.
941///
942/// ## See also
943/// - [`SDL_free`]
944/// - [`SDL_GetOriginalMemoryFunctions`]
945/// - [`SDL_GetMemoryFunctions`]
946/// - [`SDL_SetMemoryFunctions`]
947pub type SDL_free_func =
948    ::core::option::Option<unsafe extern "C" fn(mem: *mut ::core::ffi::c_void)>;
949
950unsafe extern "C" {
951    /// Get the original set of SDL memory functions.
952    ///
953    /// This is what [`SDL_malloc`] and friends will use by default, if there has been
954    /// no call to [`SDL_SetMemoryFunctions`]. This is not necessarily using the C
955    /// runtime's `malloc` functions behind the scenes! Different platforms and
956    /// build configurations might do any number of unexpected things.
957    ///
958    /// ## Parameters
959    /// - `malloc_func`: filled with malloc function.
960    /// - `calloc_func`: filled with calloc function.
961    /// - `realloc_func`: filled with realloc function.
962    /// - `free_func`: filled with free function.
963    ///
964    /// ## Thread safety
965    /// It is safe to call this function from any thread.
966    ///
967    /// ## Availability
968    /// This function is available since SDL 3.2.0.
969    pub fn SDL_GetOriginalMemoryFunctions(
970        malloc_func: *mut SDL_malloc_func,
971        calloc_func: *mut SDL_calloc_func,
972        realloc_func: *mut SDL_realloc_func,
973        free_func: *mut SDL_free_func,
974    );
975}
976
977unsafe extern "C" {
978    /// Get the current set of SDL memory functions.
979    ///
980    /// ## Parameters
981    /// - `malloc_func`: filled with malloc function.
982    /// - `calloc_func`: filled with calloc function.
983    /// - `realloc_func`: filled with realloc function.
984    /// - `free_func`: filled with free function.
985    ///
986    /// ## Thread safety
987    /// This does not hold a lock, so do not call this in the
988    ///   unlikely event of a background thread calling
989    ///   [`SDL_SetMemoryFunctions`] simultaneously.
990    ///
991    /// ## Availability
992    /// This function is available since SDL 3.2.0.
993    ///
994    /// ## See also
995    /// - [`SDL_SetMemoryFunctions`]
996    /// - [`SDL_GetOriginalMemoryFunctions`]
997    pub fn SDL_GetMemoryFunctions(
998        malloc_func: *mut SDL_malloc_func,
999        calloc_func: *mut SDL_calloc_func,
1000        realloc_func: *mut SDL_realloc_func,
1001        free_func: *mut SDL_free_func,
1002    );
1003}
1004
1005unsafe extern "C" {
1006    /// Replace SDL's memory allocation functions with a custom set.
1007    ///
1008    /// It is not safe to call this function once any allocations have been made,
1009    /// as future calls to [`SDL_free`] will use the new allocator, even if they came
1010    /// from an [`SDL_malloc`] made with the old one!
1011    ///
1012    /// If used, usually this needs to be the first call made into the SDL library,
1013    /// if not the very first thing done at program startup time.
1014    ///
1015    /// ## Parameters
1016    /// - `malloc_func`: custom malloc function.
1017    /// - `calloc_func`: custom calloc function.
1018    /// - `realloc_func`: custom realloc function.
1019    /// - `free_func`: custom free function.
1020    ///
1021    /// ## Return value
1022    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1023    ///   information.
1024    ///
1025    /// ## Thread safety
1026    /// It is safe to call this function from any thread, but one
1027    ///   should not replace the memory functions once any allocations
1028    ///   are made!
1029    ///
1030    /// ## Availability
1031    /// This function is available since SDL 3.2.0.
1032    ///
1033    /// ## See also
1034    /// - [`SDL_GetMemoryFunctions`]
1035    /// - [`SDL_GetOriginalMemoryFunctions`]
1036    pub fn SDL_SetMemoryFunctions(
1037        malloc_func: SDL_malloc_func,
1038        calloc_func: SDL_calloc_func,
1039        realloc_func: SDL_realloc_func,
1040        free_func: SDL_free_func,
1041    ) -> ::core::primitive::bool;
1042}
1043
1044unsafe extern "C" {
1045    /// Allocate memory aligned to a specific alignment.
1046    ///
1047    /// The memory returned by this function must be freed with [`SDL_aligned_free()`],
1048    /// _not_ [`SDL_free()`].
1049    ///
1050    /// If `alignment` is less than the size of `void *`, it will be increased to
1051    /// match that.
1052    ///
1053    /// The returned memory address will be a multiple of the alignment value, and
1054    /// the size of the memory allocated will be a multiple of the alignment value.
1055    ///
1056    /// ## Parameters
1057    /// - `alignment`: the alignment of the memory.
1058    /// - `size`: the size to allocate.
1059    ///
1060    /// ## Return value
1061    /// Returns a pointer to the aligned memory, or NULL if allocation failed.
1062    ///
1063    /// ## Thread safety
1064    /// It is safe to call this function from any thread.
1065    ///
1066    /// ## Availability
1067    /// This function is available since SDL 3.2.0.
1068    ///
1069    /// ## See also
1070    /// - [`SDL_aligned_free`]
1071    pub fn SDL_aligned_alloc(
1072        alignment: ::core::primitive::usize,
1073        size: ::core::primitive::usize,
1074    ) -> *mut ::core::ffi::c_void;
1075}
1076
1077unsafe extern "C" {
1078    /// Free memory allocated by [`SDL_aligned_alloc()`].
1079    ///
1080    /// The pointer is no longer valid after this call and cannot be dereferenced
1081    /// anymore.
1082    ///
1083    /// If `mem` is NULL, this function does nothing.
1084    ///
1085    /// ## Parameters
1086    /// - `mem`: a pointer previously returned by [`SDL_aligned_alloc()`], or NULL.
1087    ///
1088    /// ## Thread safety
1089    /// It is safe to call this function from any thread.
1090    ///
1091    /// ## Availability
1092    /// This function is available since SDL 3.2.0.
1093    ///
1094    /// ## See also
1095    /// - [`SDL_aligned_alloc`]
1096    pub fn SDL_aligned_free(mem: *mut ::core::ffi::c_void);
1097}
1098
1099unsafe extern "C" {
1100    /// Get the number of outstanding (unfreed) allocations.
1101    ///
1102    /// ## Return value
1103    /// Returns the number of allocations or -1 if allocation counting is
1104    ///   disabled.
1105    ///
1106    /// ## Thread safety
1107    /// It is safe to call this function from any thread.
1108    ///
1109    /// ## Availability
1110    /// This function is available since SDL 3.2.0.
1111    pub safe fn SDL_GetNumAllocations() -> ::core::ffi::c_int;
1112}
1113
1114unsafe extern "C" {
1115    /// Get the process environment.
1116    ///
1117    /// This is initialized at application start and is not affected by setenv()
1118    /// and unsetenv() calls after that point. Use [`SDL_SetEnvironmentVariable()`] and
1119    /// [`SDL_UnsetEnvironmentVariable()`] if you want to modify this environment, or
1120    /// [`SDL_setenv_unsafe()`] or [`SDL_unsetenv_unsafe()`] if you want changes to persist
1121    /// in the C runtime environment after [`SDL_Quit()`].
1122    ///
1123    /// ## Return value
1124    /// Returns a pointer to the environment for the process or NULL on failure;
1125    ///   call [`SDL_GetError()`] for more information.
1126    ///
1127    /// ## Thread safety
1128    /// It is safe to call this function from any thread.
1129    ///
1130    /// ## Availability
1131    /// This function is available since SDL 3.2.0.
1132    ///
1133    /// ## See also
1134    /// - [`SDL_GetEnvironmentVariable`]
1135    /// - [`SDL_GetEnvironmentVariables`]
1136    /// - [`SDL_SetEnvironmentVariable`]
1137    /// - [`SDL_UnsetEnvironmentVariable`]
1138    pub fn SDL_GetEnvironment() -> *mut SDL_Environment;
1139}
1140
1141unsafe extern "C" {
1142    /// Create a set of environment variables
1143    ///
1144    /// ## Parameters
1145    /// - `populated`: true to initialize it from the C runtime environment,
1146    ///   false to create an empty environment.
1147    ///
1148    /// ## Return value
1149    /// Returns a pointer to the new environment or NULL on failure; call
1150    ///   [`SDL_GetError()`] for more information.
1151    ///
1152    /// ## Thread safety
1153    /// If `populated` is false, it is safe to call this function
1154    ///   from any thread, otherwise it is safe if no other threads are
1155    ///   calling setenv() or unsetenv()
1156    ///
1157    /// ## Availability
1158    /// This function is available since SDL 3.2.0.
1159    ///
1160    /// ## See also
1161    /// - [`SDL_GetEnvironmentVariable`]
1162    /// - [`SDL_GetEnvironmentVariables`]
1163    /// - [`SDL_SetEnvironmentVariable`]
1164    /// - [`SDL_UnsetEnvironmentVariable`]
1165    /// - [`SDL_DestroyEnvironment`]
1166    pub fn SDL_CreateEnvironment(populated: ::core::primitive::bool) -> *mut SDL_Environment;
1167}
1168
1169unsafe extern "C" {
1170    /// Get the value of a variable in the environment.
1171    ///
1172    /// ## Parameters
1173    /// - `env`: the environment to query.
1174    /// - `name`: the name of the variable to get.
1175    ///
1176    /// ## Return value
1177    /// Returns a pointer to the value of the variable or NULL if it can't be
1178    ///   found.
1179    ///
1180    /// ## Thread safety
1181    /// It is safe to call this function from any thread.
1182    ///
1183    /// ## Availability
1184    /// This function is available since SDL 3.2.0.
1185    ///
1186    /// ## See also
1187    /// - [`SDL_GetEnvironment`]
1188    /// - [`SDL_CreateEnvironment`]
1189    /// - [`SDL_GetEnvironmentVariables`]
1190    /// - [`SDL_SetEnvironmentVariable`]
1191    /// - [`SDL_UnsetEnvironmentVariable`]
1192    pub fn SDL_GetEnvironmentVariable(
1193        env: *mut SDL_Environment,
1194        name: *const ::core::ffi::c_char,
1195    ) -> *const ::core::ffi::c_char;
1196}
1197
1198unsafe extern "C" {
1199    /// Get all variables in the environment.
1200    ///
1201    /// ## Parameters
1202    /// - `env`: the environment to query.
1203    ///
1204    /// ## Return value
1205    /// Returns a NULL terminated array of pointers to environment variables in
1206    ///   the form "variable=value" or NULL on failure; call [`SDL_GetError()`]
1207    ///   for more information. This is a single allocation that should be
1208    ///   freed with [`SDL_free()`] when it is no longer needed.
1209    ///
1210    /// ## Thread safety
1211    /// It is safe to call this function from any thread.
1212    ///
1213    /// ## Availability
1214    /// This function is available since SDL 3.2.0.
1215    ///
1216    /// ## See also
1217    /// - [`SDL_GetEnvironment`]
1218    /// - [`SDL_CreateEnvironment`]
1219    /// - [`SDL_GetEnvironmentVariables`]
1220    /// - [`SDL_SetEnvironmentVariable`]
1221    /// - [`SDL_UnsetEnvironmentVariable`]
1222    pub fn SDL_GetEnvironmentVariables(env: *mut SDL_Environment) -> *mut *mut ::core::ffi::c_char;
1223}
1224
1225unsafe extern "C" {
1226    /// Set the value of a variable in the environment.
1227    ///
1228    /// ## Parameters
1229    /// - `env`: the environment to modify.
1230    /// - `name`: the name of the variable to set.
1231    /// - `value`: the value of the variable to set.
1232    /// - `overwrite`: true to overwrite the variable if it exists, false to
1233    ///   return success without setting the variable if it already
1234    ///   exists.
1235    ///
1236    /// ## Return value
1237    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1238    ///   information.
1239    ///
1240    /// ## Thread safety
1241    /// It is safe to call this function from any thread.
1242    ///
1243    /// ## Availability
1244    /// This function is available since SDL 3.2.0.
1245    ///
1246    /// ## See also
1247    /// - [`SDL_GetEnvironment`]
1248    /// - [`SDL_CreateEnvironment`]
1249    /// - [`SDL_GetEnvironmentVariable`]
1250    /// - [`SDL_GetEnvironmentVariables`]
1251    /// - [`SDL_UnsetEnvironmentVariable`]
1252    pub fn SDL_SetEnvironmentVariable(
1253        env: *mut SDL_Environment,
1254        name: *const ::core::ffi::c_char,
1255        value: *const ::core::ffi::c_char,
1256        overwrite: ::core::primitive::bool,
1257    ) -> ::core::primitive::bool;
1258}
1259
1260unsafe extern "C" {
1261    /// Clear a variable from the environment.
1262    ///
1263    /// ## Parameters
1264    /// - `env`: the environment to modify.
1265    /// - `name`: the name of the variable to unset.
1266    ///
1267    /// ## Return value
1268    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1269    ///   information.
1270    ///
1271    /// ## Thread safety
1272    /// It is safe to call this function from any thread.
1273    ///
1274    /// ## Availability
1275    /// This function is available since SDL 3.2.0.
1276    ///
1277    /// ## See also
1278    /// - [`SDL_GetEnvironment`]
1279    /// - [`SDL_CreateEnvironment`]
1280    /// - [`SDL_GetEnvironmentVariable`]
1281    /// - [`SDL_GetEnvironmentVariables`]
1282    /// - [`SDL_SetEnvironmentVariable`]
1283    /// - [`SDL_UnsetEnvironmentVariable`]
1284    pub fn SDL_UnsetEnvironmentVariable(
1285        env: *mut SDL_Environment,
1286        name: *const ::core::ffi::c_char,
1287    ) -> ::core::primitive::bool;
1288}
1289
1290unsafe extern "C" {
1291    /// Destroy a set of environment variables.
1292    ///
1293    /// ## Parameters
1294    /// - `env`: the environment to destroy.
1295    ///
1296    /// ## Thread safety
1297    /// It is safe to call this function from any thread, as long as
1298    ///   the environment is no longer in use.
1299    ///
1300    /// ## Availability
1301    /// This function is available since SDL 3.2.0.
1302    ///
1303    /// ## See also
1304    /// - [`SDL_CreateEnvironment`]
1305    pub fn SDL_DestroyEnvironment(env: *mut SDL_Environment);
1306}
1307
1308unsafe extern "C" {
1309    /// Get the value of a variable in the environment.
1310    ///
1311    /// The name of the variable is case sensitive on all platforms.
1312    ///
1313    /// This function uses SDL's cached copy of the environment and is thread-safe.
1314    ///
1315    /// ## Parameters
1316    /// - `name`: the name of the variable to get.
1317    ///
1318    /// ## Return value
1319    /// Returns a pointer to the value of the variable or NULL if it can't be
1320    ///   found.
1321    ///
1322    /// ## Thread safety
1323    /// It is safe to call this function from any thread.
1324    ///
1325    /// ## Availability
1326    /// This function is available since SDL 3.2.0.
1327    pub fn SDL_getenv(name: *const ::core::ffi::c_char) -> *const ::core::ffi::c_char;
1328}
1329
1330unsafe extern "C" {
1331    /// Get the value of a variable in the environment.
1332    ///
1333    /// This function bypasses SDL's cached copy of the environment and is not
1334    /// thread-safe.
1335    ///
1336    /// On some platforms, this may make case-insensitive matches, while other
1337    /// platforms are case-sensitive. It is best to be precise with strings used
1338    /// for queries through this interface. [`SDL_getenv`] is always case-sensitive,
1339    /// however.
1340    ///
1341    /// ## Parameters
1342    /// - `name`: the name of the variable to get.
1343    ///
1344    /// ## Return value
1345    /// Returns a pointer to the value of the variable or NULL if it can't be
1346    ///   found.
1347    ///
1348    /// ## Thread safety
1349    /// This function is not thread safe, consider using [`SDL_getenv()`]
1350    ///   instead.
1351    ///
1352    /// ## Availability
1353    /// This function is available since SDL 3.2.0.
1354    ///
1355    /// ## See also
1356    /// - [`SDL_getenv`]
1357    pub fn SDL_getenv_unsafe(name: *const ::core::ffi::c_char) -> *const ::core::ffi::c_char;
1358}
1359
1360unsafe extern "C" {
1361    /// Set the value of a variable in the environment.
1362    ///
1363    /// ## Parameters
1364    /// - `name`: the name of the variable to set.
1365    /// - `value`: the value of the variable to set.
1366    /// - `overwrite`: 1 to overwrite the variable if it exists, 0 to return
1367    ///   success without setting the variable if it already exists.
1368    ///
1369    /// ## Return value
1370    /// Returns 0 on success, -1 on error.
1371    ///
1372    /// ## Thread safety
1373    /// This function is not thread safe, consider using
1374    ///   [`SDL_SetEnvironmentVariable()`] instead.
1375    ///
1376    /// ## Availability
1377    /// This function is available since SDL 3.2.0.
1378    ///
1379    /// ## See also
1380    /// - [`SDL_SetEnvironmentVariable`]
1381    pub fn SDL_setenv_unsafe(
1382        name: *const ::core::ffi::c_char,
1383        value: *const ::core::ffi::c_char,
1384        overwrite: ::core::ffi::c_int,
1385    ) -> ::core::ffi::c_int;
1386}
1387
1388unsafe extern "C" {
1389    /// Clear a variable from the environment.
1390    ///
1391    /// ## Parameters
1392    /// - `name`: the name of the variable to unset.
1393    ///
1394    /// ## Return value
1395    /// Returns 0 on success, -1 on error.
1396    ///
1397    /// ## Thread safety
1398    /// This function is not thread safe, consider using
1399    ///   [`SDL_UnsetEnvironmentVariable()`] instead.
1400    ///
1401    /// ## Availability
1402    /// This function is available since SDL 3.2.0.
1403    ///
1404    /// ## See also
1405    /// - [`SDL_UnsetEnvironmentVariable`]
1406    pub fn SDL_unsetenv_unsafe(name: *const ::core::ffi::c_char) -> ::core::ffi::c_int;
1407}
1408
1409/// A callback used with SDL sorting and binary search functions.
1410///
1411/// ## Parameters
1412/// - `a`: a pointer to the first element being compared.
1413/// - `b`: a pointer to the second element being compared.
1414///
1415/// ## Return value
1416/// Returns -1 if `a` should be sorted before `b`, 1 if `b` should be sorted
1417///   before `a`, 0 if they are equal. If two elements are equal, their
1418///   order in the sorted array is undefined.
1419///
1420/// ## Availability
1421/// This callback is available since SDL 3.2.0.
1422///
1423/// ## See also
1424/// - [`SDL_bsearch`]
1425/// - [`SDL_qsort`]
1426pub type SDL_CompareCallback = ::core::option::Option<
1427    unsafe extern "C" fn(
1428        a: *const ::core::ffi::c_void,
1429        b: *const ::core::ffi::c_void,
1430    ) -> ::core::ffi::c_int,
1431>;
1432
1433unsafe extern "C" {
1434    /// Sort an array.
1435    ///
1436    /// For example:
1437    ///
1438    /// ```c
1439    /// typedef struct {
1440    ///     int key;
1441    ///     const char *string;
1442    /// } data;
1443    ///
1444    /// int SDLCALL compare(const void *a, const void *b)
1445    /// {
1446    ///     const data *A = (const data *)a;
1447    ///     const data *B = (const data *)b;
1448    ///
1449    ///     if (A->n < B->n) {
1450    ///         return -1;
1451    ///     } else if (B->n < A->n) {
1452    ///         return 1;
1453    ///     } else {
1454    ///         return 0;
1455    ///     }
1456    /// }
1457    ///
1458    /// data values[] = {
1459    ///     { 3, "third" }, { 1, "first" }, { 2, "second" }
1460    /// };
1461    ///
1462    /// SDL_qsort(values, SDL_arraysize(values), sizeof(values[0]), compare);
1463    /// ```
1464    ///
1465    /// ## Parameters
1466    /// - `base`: a pointer to the start of the array.
1467    /// - `nmemb`: the number of elements in the array.
1468    /// - `size`: the size of the elements in the array.
1469    /// - `compare`: a function used to compare elements in the array.
1470    ///
1471    /// ## Thread safety
1472    /// It is safe to call this function from any thread.
1473    ///
1474    /// ## Availability
1475    /// This function is available since SDL 3.2.0.
1476    ///
1477    /// ## See also
1478    /// - [`SDL_bsearch`]
1479    /// - [`SDL_qsort_r`]
1480    pub fn SDL_qsort(
1481        base: *mut ::core::ffi::c_void,
1482        nmemb: ::core::primitive::usize,
1483        size: ::core::primitive::usize,
1484        compare: SDL_CompareCallback,
1485    );
1486}
1487
1488unsafe extern "C" {
1489    /// Perform a binary search on a previously sorted array.
1490    ///
1491    /// For example:
1492    ///
1493    /// ```c
1494    /// typedef struct {
1495    ///     int key;
1496    ///     const char *string;
1497    /// } data;
1498    ///
1499    /// int SDLCALL compare(const void *a, const void *b)
1500    /// {
1501    ///     const data *A = (const data *)a;
1502    ///     const data *B = (const data *)b;
1503    ///
1504    ///     if (A->n < B->n) {
1505    ///         return -1;
1506    ///     } else if (B->n < A->n) {
1507    ///         return 1;
1508    ///     } else {
1509    ///         return 0;
1510    ///     }
1511    /// }
1512    ///
1513    /// data values[] = {
1514    ///     { 1, "first" }, { 2, "second" }, { 3, "third" }
1515    /// };
1516    /// data key = { 2, NULL };
1517    ///
1518    /// data *result = SDL_bsearch(&key, values, SDL_arraysize(values), sizeof(values[0]), compare);
1519    /// ```
1520    ///
1521    /// ## Parameters
1522    /// - `key`: a pointer to a key equal to the element being searched for.
1523    /// - `base`: a pointer to the start of the array.
1524    /// - `nmemb`: the number of elements in the array.
1525    /// - `size`: the size of the elements in the array.
1526    /// - `compare`: a function used to compare elements in the array.
1527    ///
1528    /// ## Return value
1529    /// Returns a pointer to the matching element in the array, or NULL if not
1530    ///   found.
1531    ///
1532    /// ## Thread safety
1533    /// It is safe to call this function from any thread.
1534    ///
1535    /// ## Availability
1536    /// This function is available since SDL 3.2.0.
1537    ///
1538    /// ## See also
1539    /// - [`SDL_bsearch_r`]
1540    /// - [`SDL_qsort`]
1541    pub fn SDL_bsearch(
1542        key: *const ::core::ffi::c_void,
1543        base: *const ::core::ffi::c_void,
1544        nmemb: ::core::primitive::usize,
1545        size: ::core::primitive::usize,
1546        compare: SDL_CompareCallback,
1547    ) -> *mut ::core::ffi::c_void;
1548}
1549
1550/// A callback used with SDL sorting and binary search functions.
1551///
1552/// ## Parameters
1553/// - `userdata`: the `userdata` pointer passed to the sort function.
1554/// - `a`: a pointer to the first element being compared.
1555/// - `b`: a pointer to the second element being compared.
1556///
1557/// ## Return value
1558/// Returns -1 if `a` should be sorted before `b`, 1 if `b` should be sorted
1559///   before `a`, 0 if they are equal. If two elements are equal, their
1560///   order in the sorted array is undefined.
1561///
1562/// ## Availability
1563/// This callback is available since SDL 3.2.0.
1564///
1565/// ## See also
1566/// - [`SDL_qsort_r`]
1567/// - [`SDL_bsearch_r`]
1568pub type SDL_CompareCallback_r = ::core::option::Option<
1569    unsafe extern "C" fn(
1570        userdata: *mut ::core::ffi::c_void,
1571        a: *const ::core::ffi::c_void,
1572        b: *const ::core::ffi::c_void,
1573    ) -> ::core::ffi::c_int,
1574>;
1575
1576unsafe extern "C" {
1577    /// Sort an array, passing a userdata pointer to the compare function.
1578    ///
1579    /// For example:
1580    ///
1581    /// ```c
1582    /// typedef enum {
1583    ///     sort_increasing,
1584    ///     sort_decreasing,
1585    /// } sort_method;
1586    ///
1587    /// typedef struct {
1588    ///     int key;
1589    ///     const char *string;
1590    /// } data;
1591    ///
1592    /// int SDLCALL compare(const void *userdata, const void *a, const void *b)
1593    /// {
1594    ///     sort_method method = (sort_method)(uintptr_t)userdata;
1595    ///     const data *A = (const data *)a;
1596    ///     const data *B = (const data *)b;
1597    ///
1598    ///     if (A->key < B->key) {
1599    ///         return (method == sort_increasing) ? -1 : 1;
1600    ///     } else if (B->key < A->key) {
1601    ///         return (method == sort_increasing) ? 1 : -1;
1602    ///     } else {
1603    ///         return 0;
1604    ///     }
1605    /// }
1606    ///
1607    /// data values[] = {
1608    ///     { 3, "third" }, { 1, "first" }, { 2, "second" }
1609    /// };
1610    ///
1611    /// SDL_qsort_r(values, SDL_arraysize(values), sizeof(values[0]), compare, (const void *)(uintptr_t)sort_increasing);
1612    /// ```
1613    ///
1614    /// ## Parameters
1615    /// - `base`: a pointer to the start of the array.
1616    /// - `nmemb`: the number of elements in the array.
1617    /// - `size`: the size of the elements in the array.
1618    /// - `compare`: a function used to compare elements in the array.
1619    /// - `userdata`: a pointer to pass to the compare function.
1620    ///
1621    /// ## Thread safety
1622    /// It is safe to call this function from any thread.
1623    ///
1624    /// ## Availability
1625    /// This function is available since SDL 3.2.0.
1626    ///
1627    /// ## See also
1628    /// - [`SDL_bsearch_r`]
1629    /// - [`SDL_qsort`]
1630    pub fn SDL_qsort_r(
1631        base: *mut ::core::ffi::c_void,
1632        nmemb: ::core::primitive::usize,
1633        size: ::core::primitive::usize,
1634        compare: SDL_CompareCallback_r,
1635        userdata: *mut ::core::ffi::c_void,
1636    );
1637}
1638
1639unsafe extern "C" {
1640    /// Perform a binary search on a previously sorted array, passing a userdata
1641    /// pointer to the compare function.
1642    ///
1643    /// For example:
1644    ///
1645    /// ```c
1646    /// typedef enum {
1647    ///     sort_increasing,
1648    ///     sort_decreasing,
1649    /// } sort_method;
1650    ///
1651    /// typedef struct {
1652    ///     int key;
1653    ///     const char *string;
1654    /// } data;
1655    ///
1656    /// int SDLCALL compare(const void *userdata, const void *a, const void *b)
1657    /// {
1658    ///     sort_method method = (sort_method)(uintptr_t)userdata;
1659    ///     const data *A = (const data *)a;
1660    ///     const data *B = (const data *)b;
1661    ///
1662    ///     if (A->key < B->key) {
1663    ///         return (method == sort_increasing) ? -1 : 1;
1664    ///     } else if (B->key < A->key) {
1665    ///         return (method == sort_increasing) ? 1 : -1;
1666    ///     } else {
1667    ///         return 0;
1668    ///     }
1669    /// }
1670    ///
1671    /// data values[] = {
1672    ///     { 1, "first" }, { 2, "second" }, { 3, "third" }
1673    /// };
1674    /// data key = { 2, NULL };
1675    ///
1676    /// data *result = SDL_bsearch_r(&key, values, SDL_arraysize(values), sizeof(values[0]), compare, (const void *)(uintptr_t)sort_increasing);
1677    /// ```
1678    ///
1679    /// ## Parameters
1680    /// - `key`: a pointer to a key equal to the element being searched for.
1681    /// - `base`: a pointer to the start of the array.
1682    /// - `nmemb`: the number of elements in the array.
1683    /// - `size`: the size of the elements in the array.
1684    /// - `compare`: a function used to compare elements in the array.
1685    /// - `userdata`: a pointer to pass to the compare function.
1686    ///
1687    /// ## Return value
1688    /// Returns a pointer to the matching element in the array, or NULL if not
1689    ///   found.
1690    ///
1691    /// ## Thread safety
1692    /// It is safe to call this function from any thread.
1693    ///
1694    /// ## Availability
1695    /// This function is available since SDL 3.2.0.
1696    ///
1697    /// ## See also
1698    /// - [`SDL_bsearch`]
1699    /// - [`SDL_qsort_r`]
1700    pub fn SDL_bsearch_r(
1701        key: *const ::core::ffi::c_void,
1702        base: *const ::core::ffi::c_void,
1703        nmemb: ::core::primitive::usize,
1704        size: ::core::primitive::usize,
1705        compare: SDL_CompareCallback_r,
1706        userdata: *mut ::core::ffi::c_void,
1707    ) -> *mut ::core::ffi::c_void;
1708}
1709
1710/// Compute the absolute value of `x`.
1711///
1712/// ## Parameters
1713/// - `x`: an integer value.
1714///
1715/// ## Return value
1716/// Returns the absolute value of x.
1717///
1718/// ## Thread safety
1719/// It is safe to call this function from any thread.
1720///
1721/// ## Availability
1722/// This function is available since SDL 3.2.0.
1723#[inline(always)]
1724pub const fn SDL_abs(x: ::core::ffi::c_int) -> ::core::ffi::c_int {
1725    return x.unsigned_abs() as _;
1726}
1727
1728#[inline(always)]
1729pub fn SDL_min<T: Copy + PartialOrd>(x: T, y: T) -> T {
1730    if x < y { x } else { y }
1731}
1732
1733#[inline(always)]
1734pub fn SDL_max<T: Copy + PartialOrd>(x: T, y: T) -> T {
1735    if x > y { x } else { y }
1736}
1737
1738#[inline(always)]
1739pub fn SDL_clamp<T: Copy + PartialOrd>(x: T, a: T, b: T) -> T {
1740    if x < a {
1741        a
1742    } else if x > b {
1743        b
1744    } else {
1745        x
1746    }
1747}
1748
1749unsafe extern "C" {
1750    /// Query if a character is alphabetic (a letter).
1751    ///
1752    /// **WARNING**: Regardless of system locale, this will only treat ASCII values
1753    /// for English 'a-z' and 'A-Z' as true.
1754    ///
1755    /// ## Parameters
1756    /// - `x`: character value to check.
1757    ///
1758    /// ## Return value
1759    /// Returns non-zero if x falls within the character class, zero otherwise.
1760    ///
1761    /// ## Thread safety
1762    /// It is safe to call this function from any thread.
1763    ///
1764    /// ## Availability
1765    /// This function is available since SDL 3.2.0.
1766    pub safe fn SDL_isalpha(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1767}
1768
1769unsafe extern "C" {
1770    /// Query if a character is alphabetic (a letter) or a number.
1771    ///
1772    /// **WARNING**: Regardless of system locale, this will only treat ASCII values
1773    /// for English 'a-z', 'A-Z', and '0-9' as true.
1774    ///
1775    /// ## Parameters
1776    /// - `x`: character value to check.
1777    ///
1778    /// ## Return value
1779    /// Returns non-zero if x falls within the character class, zero otherwise.
1780    ///
1781    /// ## Thread safety
1782    /// It is safe to call this function from any thread.
1783    ///
1784    /// ## Availability
1785    /// This function is available since SDL 3.2.0.
1786    pub safe fn SDL_isalnum(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1787}
1788
1789unsafe extern "C" {
1790    /// Report if a character is blank (a space or tab).
1791    ///
1792    /// **WARNING**: Regardless of system locale, this will only treat ASCII values
1793    /// 0x20 (space) or 0x9 (tab) as true.
1794    ///
1795    /// ## Parameters
1796    /// - `x`: character value to check.
1797    ///
1798    /// ## Return value
1799    /// Returns non-zero if x falls within the character class, zero otherwise.
1800    ///
1801    /// ## Thread safety
1802    /// It is safe to call this function from any thread.
1803    ///
1804    /// ## Availability
1805    /// This function is available since SDL 3.2.0.
1806    pub safe fn SDL_isblank(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1807}
1808
1809unsafe extern "C" {
1810    /// Report if a character is a control character.
1811    ///
1812    /// **WARNING**: Regardless of system locale, this will only treat ASCII values
1813    /// 0 through 0x1F, and 0x7F, as true.
1814    ///
1815    /// ## Parameters
1816    /// - `x`: character value to check.
1817    ///
1818    /// ## Return value
1819    /// Returns non-zero if x falls within the character class, zero otherwise.
1820    ///
1821    /// ## Thread safety
1822    /// It is safe to call this function from any thread.
1823    ///
1824    /// ## Availability
1825    /// This function is available since SDL 3.2.0.
1826    pub safe fn SDL_iscntrl(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1827}
1828
1829unsafe extern "C" {
1830    /// Report if a character is a numeric digit.
1831    ///
1832    /// **WARNING**: Regardless of system locale, this will only treat ASCII values
1833    /// '0' (0x30) through '9' (0x39), as true.
1834    ///
1835    /// ## Parameters
1836    /// - `x`: character value to check.
1837    ///
1838    /// ## Return value
1839    /// Returns non-zero if x falls within the character class, zero otherwise.
1840    ///
1841    /// ## Thread safety
1842    /// It is safe to call this function from any thread.
1843    ///
1844    /// ## Availability
1845    /// This function is available since SDL 3.2.0.
1846    pub safe fn SDL_isdigit(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1847}
1848
1849unsafe extern "C" {
1850    /// Report if a character is a hexadecimal digit.
1851    ///
1852    /// **WARNING**: Regardless of system locale, this will only treat ASCII values
1853    /// 'A' through 'F', 'a' through 'f', and '0' through '9', as true.
1854    ///
1855    /// ## Parameters
1856    /// - `x`: character value to check.
1857    ///
1858    /// ## Return value
1859    /// Returns non-zero if x falls within the character class, zero otherwise.
1860    ///
1861    /// ## Thread safety
1862    /// It is safe to call this function from any thread.
1863    ///
1864    /// ## Availability
1865    /// This function is available since SDL 3.2.0.
1866    pub safe fn SDL_isxdigit(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1867}
1868
1869unsafe extern "C" {
1870    /// Report if a character is a punctuation mark.
1871    ///
1872    /// **WARNING**: Regardless of system locale, this is equivalent to
1873    /// `((SDL_isgraph(x)) && (!SDL_isalnum(x)))`.
1874    ///
1875    /// ## Parameters
1876    /// - `x`: character value to check.
1877    ///
1878    /// ## Return value
1879    /// Returns non-zero if x falls within the character class, zero otherwise.
1880    ///
1881    /// ## Thread safety
1882    /// It is safe to call this function from any thread.
1883    ///
1884    /// ## Availability
1885    /// This function is available since SDL 3.2.0.
1886    ///
1887    /// ## See also
1888    /// - [`SDL_isgraph`]
1889    /// - [`SDL_isalnum`]
1890    pub safe fn SDL_ispunct(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1891}
1892
1893unsafe extern "C" {
1894    /// Report if a character is whitespace.
1895    ///
1896    /// **WARNING**: Regardless of system locale, this will only treat the
1897    /// following ASCII values as true:
1898    ///
1899    /// - space (0x20)
1900    /// - tab (0x09)
1901    /// - newline (0x0A)
1902    /// - vertical tab (0x0B)
1903    /// - form feed (0x0C)
1904    /// - return (0x0D)
1905    ///
1906    /// ## Parameters
1907    /// - `x`: character value to check.
1908    ///
1909    /// ## Return value
1910    /// Returns non-zero if x falls within the character class, zero otherwise.
1911    ///
1912    /// ## Thread safety
1913    /// It is safe to call this function from any thread.
1914    ///
1915    /// ## Availability
1916    /// This function is available since SDL 3.2.0.
1917    pub safe fn SDL_isspace(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1918}
1919
1920unsafe extern "C" {
1921    /// Report if a character is upper case.
1922    ///
1923    /// **WARNING**: Regardless of system locale, this will only treat ASCII values
1924    /// 'A' through 'Z' as true.
1925    ///
1926    /// ## Parameters
1927    /// - `x`: character value to check.
1928    ///
1929    /// ## Return value
1930    /// Returns non-zero if x falls within the character class, zero otherwise.
1931    ///
1932    /// ## Thread safety
1933    /// It is safe to call this function from any thread.
1934    ///
1935    /// ## Availability
1936    /// This function is available since SDL 3.2.0.
1937    pub safe fn SDL_isupper(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1938}
1939
1940unsafe extern "C" {
1941    /// Report if a character is lower case.
1942    ///
1943    /// **WARNING**: Regardless of system locale, this will only treat ASCII values
1944    /// 'a' through 'z' as true.
1945    ///
1946    /// ## Parameters
1947    /// - `x`: character value to check.
1948    ///
1949    /// ## Return value
1950    /// Returns non-zero if x falls within the character class, zero otherwise.
1951    ///
1952    /// ## Thread safety
1953    /// It is safe to call this function from any thread.
1954    ///
1955    /// ## Availability
1956    /// This function is available since SDL 3.2.0.
1957    pub safe fn SDL_islower(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1958}
1959
1960unsafe extern "C" {
1961    /// Report if a character is "printable".
1962    ///
1963    /// Be advised that "printable" has a definition that goes back to text
1964    /// terminals from the dawn of computing, making this a sort of special case
1965    /// function that is not suitable for Unicode (or most any) text management.
1966    ///
1967    /// **WARNING**: Regardless of system locale, this will only treat ASCII values
1968    /// ' ' (0x20) through '~' (0x7E) as true.
1969    ///
1970    /// ## Parameters
1971    /// - `x`: character value to check.
1972    ///
1973    /// ## Return value
1974    /// Returns non-zero if x falls within the character class, zero otherwise.
1975    ///
1976    /// ## Thread safety
1977    /// It is safe to call this function from any thread.
1978    ///
1979    /// ## Availability
1980    /// This function is available since SDL 3.2.0.
1981    pub safe fn SDL_isprint(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
1982}
1983
1984unsafe extern "C" {
1985    /// Report if a character is any "printable" except space.
1986    ///
1987    /// Be advised that "printable" has a definition that goes back to text
1988    /// terminals from the dawn of computing, making this a sort of special case
1989    /// function that is not suitable for Unicode (or most any) text management.
1990    ///
1991    /// **WARNING**: Regardless of system locale, this is equivalent to
1992    /// `(SDL_isprint(x)) && ((x) != ' ')`.
1993    ///
1994    /// ## Parameters
1995    /// - `x`: character value to check.
1996    ///
1997    /// ## Return value
1998    /// Returns non-zero if x falls within the character class, zero otherwise.
1999    ///
2000    /// ## Thread safety
2001    /// It is safe to call this function from any thread.
2002    ///
2003    /// ## Availability
2004    /// This function is available since SDL 3.2.0.
2005    ///
2006    /// ## See also
2007    /// - [`SDL_isprint`]
2008    pub safe fn SDL_isgraph(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
2009}
2010
2011unsafe extern "C" {
2012    /// Convert low-ASCII English letters to uppercase.
2013    ///
2014    /// **WARNING**: Regardless of system locale, this will only convert ASCII
2015    /// values 'a' through 'z' to uppercase.
2016    ///
2017    /// This function returns the uppercase equivalent of `x`. If a character
2018    /// cannot be converted, or is already uppercase, this function returns `x`.
2019    ///
2020    /// ## Parameters
2021    /// - `x`: character value to check.
2022    ///
2023    /// ## Return value
2024    /// Returns capitalized version of x, or x if no conversion available.
2025    ///
2026    /// ## Thread safety
2027    /// It is safe to call this function from any thread.
2028    ///
2029    /// ## Availability
2030    /// This function is available since SDL 3.2.0.
2031    pub safe fn SDL_toupper(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
2032}
2033
2034unsafe extern "C" {
2035    /// Convert low-ASCII English letters to lowercase.
2036    ///
2037    /// **WARNING**: Regardless of system locale, this will only convert ASCII
2038    /// values 'A' through 'Z' to lowercase.
2039    ///
2040    /// This function returns the lowercase equivalent of `x`. If a character
2041    /// cannot be converted, or is already lowercase, this function returns `x`.
2042    ///
2043    /// ## Parameters
2044    /// - `x`: character value to check.
2045    ///
2046    /// ## Return value
2047    /// Returns lowercase version of x, or x if no conversion available.
2048    ///
2049    /// ## Thread safety
2050    /// It is safe to call this function from any thread.
2051    ///
2052    /// ## Availability
2053    /// This function is available since SDL 3.2.0.
2054    pub safe fn SDL_tolower(x: ::core::ffi::c_int) -> ::core::ffi::c_int;
2055}
2056
2057unsafe extern "C" {
2058    /// Calculate a CRC-16 value.
2059    ///
2060    /// <https://en.wikipedia.org/wiki/Cyclic_redundancy_check>
2061    ///
2062    /// This function can be called multiple times, to stream data to be
2063    /// checksummed in blocks. Each call must provide the previous CRC-16 return
2064    /// value to be updated with the next block. The first call to this function
2065    /// for a set of blocks should pass in a zero CRC value.
2066    ///
2067    /// ## Parameters
2068    /// - `crc`: the current checksum for this data set, or 0 for a new data set.
2069    /// - `data`: a new block of data to add to the checksum.
2070    /// - `len`: the size, in bytes, of the new block of data.
2071    ///
2072    /// ## Return value
2073    /// Returns a CRC-16 checksum value of all blocks in the data set.
2074    ///
2075    /// ## Thread safety
2076    /// It is safe to call this function from any thread.
2077    ///
2078    /// ## Availability
2079    /// This function is available since SDL 3.2.0.
2080    pub fn SDL_crc16(
2081        crc: Uint16,
2082        data: *const ::core::ffi::c_void,
2083        len: ::core::primitive::usize,
2084    ) -> Uint16;
2085}
2086
2087unsafe extern "C" {
2088    /// Calculate a CRC-32 value.
2089    ///
2090    /// <https://en.wikipedia.org/wiki/Cyclic_redundancy_check>
2091    ///
2092    /// This function can be called multiple times, to stream data to be
2093    /// checksummed in blocks. Each call must provide the previous CRC-32 return
2094    /// value to be updated with the next block. The first call to this function
2095    /// for a set of blocks should pass in a zero CRC value.
2096    ///
2097    /// ## Parameters
2098    /// - `crc`: the current checksum for this data set, or 0 for a new data set.
2099    /// - `data`: a new block of data to add to the checksum.
2100    /// - `len`: the size, in bytes, of the new block of data.
2101    ///
2102    /// ## Return value
2103    /// Returns a CRC-32 checksum value of all blocks in the data set.
2104    ///
2105    /// ## Thread safety
2106    /// It is safe to call this function from any thread.
2107    ///
2108    /// ## Availability
2109    /// This function is available since SDL 3.2.0.
2110    pub fn SDL_crc32(
2111        crc: Uint32,
2112        data: *const ::core::ffi::c_void,
2113        len: ::core::primitive::usize,
2114    ) -> Uint32;
2115}
2116
2117unsafe extern "C" {
2118    /// Calculate a 32-bit MurmurHash3 value for a block of data.
2119    ///
2120    /// <https://en.wikipedia.org/wiki/MurmurHash>
2121    ///
2122    /// A seed may be specified, which changes the final results consistently, but
2123    /// this does not work like [`SDL_crc16`] and [`SDL_crc32`]\: you can't feed a previous
2124    /// result from this function back into itself as the next seed value to
2125    /// calculate a hash in chunks; it won't produce the same hash as it would if
2126    /// the same data was provided in a single call.
2127    ///
2128    /// If you aren't sure what to provide for a seed, zero is fine. Murmur3 is not
2129    /// cryptographically secure, so it shouldn't be used for hashing top-secret
2130    /// data.
2131    ///
2132    /// ## Parameters
2133    /// - `data`: the data to be hashed.
2134    /// - `len`: the size of data, in bytes.
2135    /// - `seed`: a value that alters the final hash value.
2136    ///
2137    /// ## Return value
2138    /// Returns a Murmur3 32-bit hash value.
2139    ///
2140    /// ## Thread safety
2141    /// It is safe to call this function from any thread.
2142    ///
2143    /// ## Availability
2144    /// This function is available since SDL 3.2.0.
2145    pub fn SDL_murmur3_32(
2146        data: *const ::core::ffi::c_void,
2147        len: ::core::primitive::usize,
2148        seed: Uint32,
2149    ) -> Uint32;
2150}
2151
2152/// Copy non-overlapping memory.
2153///
2154/// The memory regions must not overlap. If they do, use [`SDL_memmove()`] instead.
2155///
2156/// ## Parameters
2157/// - `dst`: The destination memory region. Must not be NULL, and must not
2158///   overlap with `src`.
2159/// - `src`: The source memory region. Must not be NULL, and must not overlap
2160///   with `dst`.
2161/// - `len`: The length in bytes of both `dst` and `src`.
2162///
2163/// ## Return value
2164/// Returns `dst`.
2165///
2166/// ## Thread safety
2167/// It is safe to call this function from any thread.
2168///
2169/// ## Availability
2170/// This function is available since SDL 3.2.0.
2171///
2172/// ## See also
2173/// - [`SDL_memmove`]
2174#[inline(always)]
2175pub const unsafe fn SDL_memcpy(
2176    dst: *mut ::core::ffi::c_void,
2177    src: *const ::core::ffi::c_void,
2178    len: ::core::primitive::usize,
2179) -> *mut ::core::ffi::c_void {
2180    unsafe { ::core::ptr::copy_nonoverlapping(src.cast::<Uint8>(), dst.cast::<Uint8>(), len) };
2181    return dst;
2182}
2183
2184/// A macro to copy memory between objects, with basic type checking.
2185///
2186/// [`SDL_memcpy`] and [`SDL_memmove`] do not care where you copy memory to and from,
2187/// which can lead to bugs. This macro aims to avoid most of those bugs by
2188/// making sure that the source and destination are both pointers to objects
2189/// that are the same size. It does not check that the objects are the same
2190/// _type_, just that the copy will not overflow either object.
2191///
2192/// The size check happens at compile time, and the compiler will throw an
2193/// error if the objects are different sizes.
2194///
2195/// Generally this is intended to copy a single object, not an array.
2196///
2197/// This macro looks like it double-evaluates its parameters, but the extras
2198/// them are in `sizeof` sections, which generate no code nor side-effects.
2199///
2200/// ## Parameters
2201/// - `dst`: a pointer to the destination object. Must not be NULL.
2202/// - `src`: a pointer to the source object. Must not be NULL.
2203///
2204/// ## Thread safety
2205/// It is safe to call this function from any thread.
2206///
2207/// ## Availability
2208/// This function is available since SDL 3.2.0.
2209///
2210/// # Safety
2211/// It must be valid to write the memory pointed to by `src` to the memory pointed to by `dst`,
2212/// and the memory pointed to by `src` and `dst` must not overlap
2213#[inline(always)]
2214pub unsafe fn SDL_copyp<Dst: Sized, Src: Sized>(dst: *mut Dst, src: *const Src) -> *mut Dst {
2215    const { assert!(::core::mem::size_of::<Dst>() == ::core::mem::size_of::<Src>()) }
2216    unsafe {
2217        ::core::ptr::copy_nonoverlapping(
2218            src.cast::<Uint8>(),
2219            dst.cast::<Uint8>(),
2220            ::core::mem::size_of::<Src>(),
2221        )
2222    };
2223    dst
2224}
2225
2226/// Copy memory ranges that might overlap.
2227///
2228/// It is okay for the memory regions to overlap. If you are confident that the
2229/// regions never overlap, using [`SDL_memcpy()`] may improve performance.
2230///
2231/// ## Parameters
2232/// - `dst`: The destination memory region. Must not be NULL.
2233/// - `src`: The source memory region. Must not be NULL.
2234/// - `len`: The length in bytes of both `dst` and `src`.
2235///
2236/// ## Return value
2237/// Returns `dst`.
2238///
2239/// ## Thread safety
2240/// It is safe to call this function from any thread.
2241///
2242/// ## Availability
2243/// This function is available since SDL 3.2.0.
2244///
2245/// ## See also
2246/// - [`SDL_memcpy`]
2247#[inline(always)]
2248pub const unsafe fn SDL_memmove(
2249    dst: *mut ::core::ffi::c_void,
2250    src: *const ::core::ffi::c_void,
2251    len: ::core::primitive::usize,
2252) -> *mut ::core::ffi::c_void {
2253    unsafe { ::core::ptr::copy(src.cast::<Uint8>(), dst.cast::<Uint8>(), len) };
2254    return dst;
2255}
2256
2257unsafe extern "C" {
2258    /// Initialize all bytes of buffer of memory to a specific value.
2259    ///
2260    /// This function will set `len` bytes, pointed to by `dst`, to the value
2261    /// specified in `c`.
2262    ///
2263    /// Despite `c` being an `int` instead of a `char`, this only operates on
2264    /// bytes; `c` must be a value between 0 and 255, inclusive.
2265    ///
2266    /// ## Parameters
2267    /// - `dst`: the destination memory region. Must not be NULL.
2268    /// - `c`: the byte value to set.
2269    /// - `len`: the length, in bytes, to set in `dst`.
2270    ///
2271    /// ## Return value
2272    /// Returns `dst`.
2273    ///
2274    /// ## Thread safety
2275    /// It is safe to call this function from any thread.
2276    ///
2277    /// ## Availability
2278    /// This function is available since SDL 3.2.0.
2279    pub fn SDL_memset(
2280        dst: *mut ::core::ffi::c_void,
2281        c: ::core::ffi::c_int,
2282        len: ::core::primitive::usize,
2283    ) -> *mut ::core::ffi::c_void;
2284}
2285
2286unsafe extern "C" {
2287    /// Initialize all 32-bit words of buffer of memory to a specific value.
2288    ///
2289    /// This function will set a buffer of `dwords` Uint32 values, pointed to by
2290    /// `dst`, to the value specified in `val`.
2291    ///
2292    /// Unlike [`SDL_memset`], this sets 32-bit values, not bytes, so it's not limited
2293    /// to a range of 0-255.
2294    ///
2295    /// ## Parameters
2296    /// - `dst`: the destination memory region. Must not be NULL.
2297    /// - `val`: the Uint32 value to set.
2298    /// - `dwords`: the number of Uint32 values to set in `dst`.
2299    ///
2300    /// ## Return value
2301    /// Returns `dst`.
2302    ///
2303    /// ## Thread safety
2304    /// It is safe to call this function from any thread.
2305    ///
2306    /// ## Availability
2307    /// This function is available since SDL 3.2.0.
2308    pub fn SDL_memset4(
2309        dst: *mut ::core::ffi::c_void,
2310        val: Uint32,
2311        dwords: ::core::primitive::usize,
2312    ) -> *mut ::core::ffi::c_void;
2313}
2314
2315/// Clear an object's memory to zero, using a pointer.
2316///
2317/// This is wrapper over [`SDL_memset`] that handles calculating the object size,
2318/// so there's no chance of copy/paste errors, and the code is cleaner.
2319///
2320/// This requires a pointer to an object, not an object itself, nor an array.
2321///
2322/// ## Parameters
2323/// - `x`: a pointer to the object to clear.
2324///
2325/// ## Thread safety
2326/// It is safe to call this macro from any thread.
2327///
2328/// ## Availability
2329/// This macro is available since SDL 3.2.0.
2330///
2331/// ## See also
2332/// - [`SDL_zero`]
2333/// - [`SDL_zeroa`]
2334///
2335/// # Safety
2336/// It must be valid to zero all bytes of `T`, and it must be valid to write a `T` to the memory pointed to by `x`
2337#[inline(always)]
2338pub unsafe fn SDL_zerop<T>(x: *mut T) -> *mut T {
2339    unsafe { x.write_bytes(0, 1) };
2340    x
2341}
2342
2343unsafe extern "C" {
2344    /// Compare two buffers of memory.
2345    ///
2346    /// ## Parameters
2347    /// - `s1`: the first buffer to compare. NULL is not permitted!
2348    /// - `s2`: the second buffer to compare. NULL is not permitted!
2349    /// - `len`: the number of bytes to compare between the buffers.
2350    ///
2351    /// ## Return value
2352    /// Returns less than zero if s1 is "less than" s2, greater than zero if s1 is
2353    ///   "greater than" s2, and zero if the buffers match exactly for `len`
2354    ///   bytes.
2355    ///
2356    /// ## Thread safety
2357    /// It is safe to call this function from any thread.
2358    ///
2359    /// ## Availability
2360    /// This function is available since SDL 3.2.0.
2361    pub fn SDL_memcmp(
2362        s1: *const ::core::ffi::c_void,
2363        s2: *const ::core::ffi::c_void,
2364        len: ::core::primitive::usize,
2365    ) -> ::core::ffi::c_int;
2366}
2367
2368unsafe extern "C" {
2369    /// This works exactly like wcslen() but doesn't require access to a C runtime.
2370    ///
2371    /// Counts the number of wchar_t values in `wstr`, excluding the null
2372    /// terminator.
2373    ///
2374    /// Like [`SDL_strlen`] only counts bytes and not codepoints in a UTF-8 string,
2375    /// this counts wchar_t values in a string, even if the string's encoding is of
2376    /// variable width, like UTF-16.
2377    ///
2378    /// Also be aware that wchar_t is different sizes on different platforms (4
2379    /// bytes on Linux, 2 on Windows, etc).
2380    ///
2381    /// ## Parameters
2382    /// - `wstr`: The null-terminated wide string to read. Must not be NULL.
2383    ///
2384    /// ## Return value
2385    /// Returns the length (in wchar_t values, excluding the null terminator) of
2386    ///   `wstr`.
2387    ///
2388    /// ## Thread safety
2389    /// It is safe to call this function from any thread.
2390    ///
2391    /// ## Availability
2392    /// This function is available since SDL 3.2.0.
2393    ///
2394    /// ## See also
2395    /// - [`SDL_wcsnlen`]
2396    /// - [`SDL_utf8strlen`]
2397    /// - [`SDL_utf8strnlen`]
2398    pub fn SDL_wcslen(wstr: *const crate::ffi::c_wchar_t) -> ::core::primitive::usize;
2399}
2400
2401unsafe extern "C" {
2402    /// This works exactly like wcsnlen() but doesn't require access to a C
2403    /// runtime.
2404    ///
2405    /// Counts up to a maximum of `maxlen` wchar_t values in `wstr`, excluding the
2406    /// null terminator.
2407    ///
2408    /// Like [`SDL_strnlen`] only counts bytes and not codepoints in a UTF-8 string,
2409    /// this counts wchar_t values in a string, even if the string's encoding is of
2410    /// variable width, like UTF-16.
2411    ///
2412    /// Also be aware that wchar_t is different sizes on different platforms (4
2413    /// bytes on Linux, 2 on Windows, etc).
2414    ///
2415    /// Also, `maxlen` is a count of wide characters, not bytes!
2416    ///
2417    /// ## Parameters
2418    /// - `wstr`: The null-terminated wide string to read. Must not be NULL.
2419    /// - `maxlen`: The maximum amount of wide characters to count.
2420    ///
2421    /// ## Return value
2422    /// Returns the length (in wide characters, excluding the null terminator) of
2423    ///   `wstr` but never more than `maxlen`.
2424    ///
2425    /// ## Thread safety
2426    /// It is safe to call this function from any thread.
2427    ///
2428    /// ## Availability
2429    /// This function is available since SDL 3.2.0.
2430    ///
2431    /// ## See also
2432    /// - [`SDL_wcslen`]
2433    /// - [`SDL_utf8strlen`]
2434    /// - [`SDL_utf8strnlen`]
2435    pub fn SDL_wcsnlen(
2436        wstr: *const crate::ffi::c_wchar_t,
2437        maxlen: ::core::primitive::usize,
2438    ) -> ::core::primitive::usize;
2439}
2440
2441unsafe extern "C" {
2442    /// Copy a wide string.
2443    ///
2444    /// This function copies `maxlen` - 1 wide characters from `src` to `dst`, then
2445    /// appends a null terminator.
2446    ///
2447    /// `src` and `dst` must not overlap.
2448    ///
2449    /// If `maxlen` is 0, no wide characters are copied and no null terminator is
2450    /// written.
2451    ///
2452    /// ## Parameters
2453    /// - `dst`: The destination buffer. Must not be NULL, and must not overlap
2454    ///   with `src`.
2455    /// - `src`: The null-terminated wide string to copy. Must not be NULL, and
2456    ///   must not overlap with `dst`.
2457    /// - `maxlen`: The length (in wide characters) of the destination buffer.
2458    ///
2459    /// ## Return value
2460    /// Returns the length (in wide characters, excluding the null terminator) of
2461    ///   `src`.
2462    ///
2463    /// ## Thread safety
2464    /// It is safe to call this function from any thread.
2465    ///
2466    /// ## Availability
2467    /// This function is available since SDL 3.2.0.
2468    ///
2469    /// ## See also
2470    /// - [`SDL_wcslcat`]
2471    pub fn SDL_wcslcpy(
2472        dst: *mut crate::ffi::c_wchar_t,
2473        src: *const crate::ffi::c_wchar_t,
2474        maxlen: ::core::primitive::usize,
2475    ) -> ::core::primitive::usize;
2476}
2477
2478unsafe extern "C" {
2479    /// Concatenate wide strings.
2480    ///
2481    /// This function appends up to `maxlen` - SDL_wcslen(dst) - 1 wide characters
2482    /// from `src` to the end of the wide string in `dst`, then appends a null
2483    /// terminator.
2484    ///
2485    /// `src` and `dst` must not overlap.
2486    ///
2487    /// If `maxlen` - SDL_wcslen(dst) - 1 is less than or equal to 0, then `dst` is
2488    /// unmodified.
2489    ///
2490    /// ## Parameters
2491    /// - `dst`: The destination buffer already containing the first
2492    ///   null-terminated wide string. Must not be NULL and must not
2493    ///   overlap with `src`.
2494    /// - `src`: The second null-terminated wide string. Must not be NULL, and
2495    ///   must not overlap with `dst`.
2496    /// - `maxlen`: The length (in wide characters) of the destination buffer.
2497    ///
2498    /// ## Return value
2499    /// Returns the length (in wide characters, excluding the null terminator) of
2500    ///   the string in `dst` plus the length of `src`.
2501    ///
2502    /// ## Thread safety
2503    /// It is safe to call this function from any thread.
2504    ///
2505    /// ## Availability
2506    /// This function is available since SDL 3.2.0.
2507    ///
2508    /// ## See also
2509    /// - [`SDL_wcslcpy`]
2510    pub fn SDL_wcslcat(
2511        dst: *mut crate::ffi::c_wchar_t,
2512        src: *const crate::ffi::c_wchar_t,
2513        maxlen: ::core::primitive::usize,
2514    ) -> ::core::primitive::usize;
2515}
2516
2517unsafe extern "C" {
2518    /// Allocate a copy of a wide string.
2519    ///
2520    /// This allocates enough space for a null-terminated copy of `wstr`, using
2521    /// [`SDL_malloc`], and then makes a copy of the string into this space.
2522    ///
2523    /// The returned string is owned by the caller, and should be passed to
2524    /// [`SDL_free`] when no longer needed.
2525    ///
2526    /// ## Parameters
2527    /// - `wstr`: the string to copy.
2528    ///
2529    /// ## Return value
2530    /// Returns a pointer to the newly-allocated wide string.
2531    ///
2532    /// ## Thread safety
2533    /// It is safe to call this function from any thread.
2534    ///
2535    /// ## Availability
2536    /// This function is available since SDL 3.2.0.
2537    pub fn SDL_wcsdup(wstr: *const crate::ffi::c_wchar_t) -> *mut crate::ffi::c_wchar_t;
2538}
2539
2540unsafe extern "C" {
2541    /// Search a wide string for the first instance of a specific substring.
2542    ///
2543    /// The search ends once it finds the requested substring, or a null terminator
2544    /// byte to end the string.
2545    ///
2546    /// Note that this looks for strings of _wide characters_, not _codepoints_, so
2547    /// it's legal to search for malformed and incomplete UTF-16 sequences.
2548    ///
2549    /// ## Parameters
2550    /// - `haystack`: the wide string to search. Must not be NULL.
2551    /// - `needle`: the wide string to search for. Must not be NULL.
2552    ///
2553    /// ## Return value
2554    /// Returns a pointer to the first instance of `needle` in the string, or NULL
2555    ///   if not found.
2556    ///
2557    /// ## Thread safety
2558    /// It is safe to call this function from any thread.
2559    ///
2560    /// ## Availability
2561    /// This function is available since SDL 3.2.0.
2562    pub fn SDL_wcsstr(
2563        haystack: *const crate::ffi::c_wchar_t,
2564        needle: *const crate::ffi::c_wchar_t,
2565    ) -> *mut crate::ffi::c_wchar_t;
2566}
2567
2568unsafe extern "C" {
2569    /// Search a wide string, up to n wide chars, for the first instance of a
2570    /// specific substring.
2571    ///
2572    /// The search ends once it finds the requested substring, or a null terminator
2573    /// value to end the string, or `maxlen` wide character have been examined. It
2574    /// is possible to use this function on a wide string without a null
2575    /// terminator.
2576    ///
2577    /// Note that this looks for strings of _wide characters_, not _codepoints_, so
2578    /// it's legal to search for malformed and incomplete UTF-16 sequences.
2579    ///
2580    /// ## Parameters
2581    /// - `haystack`: the wide string to search. Must not be NULL.
2582    /// - `needle`: the wide string to search for. Must not be NULL.
2583    /// - `maxlen`: the maximum number of wide characters to search in
2584    ///   `haystack`.
2585    ///
2586    /// ## Return value
2587    /// Returns a pointer to the first instance of `needle` in the string, or NULL
2588    ///   if not found.
2589    ///
2590    /// ## Thread safety
2591    /// It is safe to call this function from any thread.
2592    ///
2593    /// ## Availability
2594    /// This function is available since SDL 3.2.0.
2595    pub fn SDL_wcsnstr(
2596        haystack: *const crate::ffi::c_wchar_t,
2597        needle: *const crate::ffi::c_wchar_t,
2598        maxlen: ::core::primitive::usize,
2599    ) -> *mut crate::ffi::c_wchar_t;
2600}
2601
2602unsafe extern "C" {
2603    /// Compare two null-terminated wide strings.
2604    ///
2605    /// This only compares wchar_t values until it hits a null-terminating
2606    /// character; it does not care if the string is well-formed UTF-16 (or UTF-32,
2607    /// depending on your platform's wchar_t size), or uses valid Unicode values.
2608    ///
2609    /// ## Parameters
2610    /// - `str1`: the first string to compare. NULL is not permitted!
2611    /// - `str2`: the second string to compare. NULL is not permitted!
2612    ///
2613    /// ## Return value
2614    /// Returns less than zero if str1 is "less than" str2, greater than zero if
2615    ///   str1 is "greater than" str2, and zero if the strings match
2616    ///   exactly.
2617    ///
2618    /// ## Thread safety
2619    /// It is safe to call this function from any thread.
2620    ///
2621    /// ## Availability
2622    /// This function is available since SDL 3.2.0.
2623    pub fn SDL_wcscmp(
2624        str1: *const crate::ffi::c_wchar_t,
2625        str2: *const crate::ffi::c_wchar_t,
2626    ) -> ::core::ffi::c_int;
2627}
2628
2629unsafe extern "C" {
2630    /// Compare two wide strings up to a number of wchar_t values.
2631    ///
2632    /// This only compares wchar_t values; it does not care if the string is
2633    /// well-formed UTF-16 (or UTF-32, depending on your platform's wchar_t size),
2634    /// or uses valid Unicode values.
2635    ///
2636    /// Note that while this function is intended to be used with UTF-16 (or
2637    /// UTF-32, depending on your platform's definition of wchar_t), it is
2638    /// comparing raw wchar_t values and not Unicode codepoints: `maxlen` specifies
2639    /// a wchar_t limit! If the limit lands in the middle of a multi-wchar UTF-16
2640    /// sequence, it will only compare a portion of the final character.
2641    ///
2642    /// `maxlen` specifies a maximum number of wchar_t to compare; if the strings
2643    /// match to this number of wide chars (or both have matched to a
2644    /// null-terminator character before this count), they will be considered
2645    /// equal.
2646    ///
2647    /// ## Parameters
2648    /// - `str1`: the first string to compare. NULL is not permitted!
2649    /// - `str2`: the second string to compare. NULL is not permitted!
2650    /// - `maxlen`: the maximum number of wchar_t to compare.
2651    ///
2652    /// ## Return value
2653    /// Returns less than zero if str1 is "less than" str2, greater than zero if
2654    ///   str1 is "greater than" str2, and zero if the strings match
2655    ///   exactly.
2656    ///
2657    /// ## Thread safety
2658    /// It is safe to call this function from any thread.
2659    ///
2660    /// ## Availability
2661    /// This function is available since SDL 3.2.0.
2662    pub fn SDL_wcsncmp(
2663        str1: *const crate::ffi::c_wchar_t,
2664        str2: *const crate::ffi::c_wchar_t,
2665        maxlen: ::core::primitive::usize,
2666    ) -> ::core::ffi::c_int;
2667}
2668
2669unsafe extern "C" {
2670    /// Compare two null-terminated wide strings, case-insensitively.
2671    ///
2672    /// This will work with Unicode strings, using a technique called
2673    /// "case-folding" to handle the vast majority of case-sensitive human
2674    /// languages regardless of system locale. It can deal with expanding values: a
2675    /// German Eszett character can compare against two ASCII 's' chars and be
2676    /// considered a match, for example. A notable exception: it does not handle
2677    /// the Turkish 'i' character; human language is complicated!
2678    ///
2679    /// Depending on your platform, "wchar_t" might be 2 bytes, and expected to be
2680    /// UTF-16 encoded (like Windows), or 4 bytes in UTF-32 format. Since this
2681    /// handles Unicode, it expects the string to be well-formed and not a
2682    /// null-terminated string of arbitrary bytes. Characters that are not valid
2683    /// UTF-16 (or UTF-32) are treated as Unicode character U+FFFD (REPLACEMENT
2684    /// CHARACTER), which is to say two strings of random bits may turn out to
2685    /// match if they convert to the same amount of replacement characters.
2686    ///
2687    /// ## Parameters
2688    /// - `str1`: the first string to compare. NULL is not permitted!
2689    /// - `str2`: the second string to compare. NULL is not permitted!
2690    ///
2691    /// ## Return value
2692    /// Returns less than zero if str1 is "less than" str2, greater than zero if
2693    ///   str1 is "greater than" str2, and zero if the strings match
2694    ///   exactly.
2695    ///
2696    /// ## Thread safety
2697    /// It is safe to call this function from any thread.
2698    ///
2699    /// ## Availability
2700    /// This function is available since SDL 3.2.0.
2701    pub fn SDL_wcscasecmp(
2702        str1: *const crate::ffi::c_wchar_t,
2703        str2: *const crate::ffi::c_wchar_t,
2704    ) -> ::core::ffi::c_int;
2705}
2706
2707unsafe extern "C" {
2708    /// Compare two wide strings, case-insensitively, up to a number of wchar_t.
2709    ///
2710    /// This will work with Unicode strings, using a technique called
2711    /// "case-folding" to handle the vast majority of case-sensitive human
2712    /// languages regardless of system locale. It can deal with expanding values: a
2713    /// German Eszett character can compare against two ASCII 's' chars and be
2714    /// considered a match, for example. A notable exception: it does not handle
2715    /// the Turkish 'i' character; human language is complicated!
2716    ///
2717    /// Depending on your platform, "wchar_t" might be 2 bytes, and expected to be
2718    /// UTF-16 encoded (like Windows), or 4 bytes in UTF-32 format. Since this
2719    /// handles Unicode, it expects the string to be well-formed and not a
2720    /// null-terminated string of arbitrary bytes. Characters that are not valid
2721    /// UTF-16 (or UTF-32) are treated as Unicode character U+FFFD (REPLACEMENT
2722    /// CHARACTER), which is to say two strings of random bits may turn out to
2723    /// match if they convert to the same amount of replacement characters.
2724    ///
2725    /// Note that while this function might deal with variable-sized characters,
2726    /// `maxlen` specifies a _wchar_ limit! If the limit lands in the middle of a
2727    /// multi-byte UTF-16 sequence, it may convert a portion of the final character
2728    /// to one or more Unicode character U+FFFD (REPLACEMENT CHARACTER) so as not
2729    /// to overflow a buffer.
2730    ///
2731    /// `maxlen` specifies a maximum number of wchar_t values to compare; if the
2732    /// strings match to this number of wchar_t (or both have matched to a
2733    /// null-terminator character before this number of bytes), they will be
2734    /// considered equal.
2735    ///
2736    /// ## Parameters
2737    /// - `str1`: the first string to compare. NULL is not permitted!
2738    /// - `str2`: the second string to compare. NULL is not permitted!
2739    /// - `maxlen`: the maximum number of wchar_t values to compare.
2740    ///
2741    /// ## Return value
2742    /// Returns less than zero if str1 is "less than" str2, greater than zero if
2743    ///   str1 is "greater than" str2, and zero if the strings match
2744    ///   exactly.
2745    ///
2746    /// ## Thread safety
2747    /// It is safe to call this function from any thread.
2748    ///
2749    /// ## Availability
2750    /// This function is available since SDL 3.2.0.
2751    pub fn SDL_wcsncasecmp(
2752        str1: *const crate::ffi::c_wchar_t,
2753        str2: *const crate::ffi::c_wchar_t,
2754        maxlen: ::core::primitive::usize,
2755    ) -> ::core::ffi::c_int;
2756}
2757
2758unsafe extern "C" {
2759    /// Parse a `long` from a wide string.
2760    ///
2761    /// If `str` starts with whitespace, then those whitespace characters are
2762    /// skipped before attempting to parse the number.
2763    ///
2764    /// If the parsed number does not fit inside a `long`, the result is clamped to
2765    /// the minimum and maximum representable `long` values.
2766    ///
2767    /// ## Parameters
2768    /// - `str`: The null-terminated wide string to read. Must not be NULL.
2769    /// - `endp`: If not NULL, the address of the first invalid wide character
2770    ///   (i.e. the next character after the parsed number) will be
2771    ///   written to this pointer.
2772    /// - `base`: The base of the integer to read. Supported values are 0 and 2
2773    ///   to 36 inclusive. If 0, the base will be inferred from the
2774    ///   number's prefix (0x for hexadecimal, 0 for octal, decimal
2775    ///   otherwise).
2776    ///
2777    /// ## Return value
2778    /// Returns the parsed `long`, or 0 if no number could be parsed.
2779    ///
2780    /// ## Thread safety
2781    /// It is safe to call this function from any thread.
2782    ///
2783    /// ## Availability
2784    /// This function is available since SDL 3.2.0.
2785    ///
2786    /// ## See also
2787    /// - [`SDL_strtol`]
2788    pub fn SDL_wcstol(
2789        str: *const crate::ffi::c_wchar_t,
2790        endp: *mut *mut crate::ffi::c_wchar_t,
2791        base: ::core::ffi::c_int,
2792    ) -> ::core::ffi::c_long;
2793}
2794
2795unsafe extern "C" {
2796    /// This works exactly like strlen() but doesn't require access to a C runtime.
2797    ///
2798    /// Counts the bytes in `str`, excluding the null terminator.
2799    ///
2800    /// If you need the length of a UTF-8 string, consider using [`SDL_utf8strlen()`].
2801    ///
2802    /// ## Parameters
2803    /// - `str`: The null-terminated string to read. Must not be NULL.
2804    ///
2805    /// ## Return value
2806    /// Returns the length (in bytes, excluding the null terminator) of `src`.
2807    ///
2808    /// ## Thread safety
2809    /// It is safe to call this function from any thread.
2810    ///
2811    /// ## Availability
2812    /// This function is available since SDL 3.2.0.
2813    ///
2814    /// ## See also
2815    /// - [`SDL_strnlen`]
2816    /// - [`SDL_utf8strlen`]
2817    /// - [`SDL_utf8strnlen`]
2818    pub fn SDL_strlen(str: *const ::core::ffi::c_char) -> ::core::primitive::usize;
2819}
2820
2821unsafe extern "C" {
2822    /// This works exactly like strnlen() but doesn't require access to a C
2823    /// runtime.
2824    ///
2825    /// Counts up to a maximum of `maxlen` bytes in `str`, excluding the null
2826    /// terminator.
2827    ///
2828    /// If you need the length of a UTF-8 string, consider using [`SDL_utf8strnlen()`].
2829    ///
2830    /// ## Parameters
2831    /// - `str`: The null-terminated string to read. Must not be NULL.
2832    /// - `maxlen`: The maximum amount of bytes to count.
2833    ///
2834    /// ## Return value
2835    /// Returns the length (in bytes, excluding the null terminator) of `src` but
2836    ///   never more than `maxlen`.
2837    ///
2838    /// ## Thread safety
2839    /// It is safe to call this function from any thread.
2840    ///
2841    /// ## Availability
2842    /// This function is available since SDL 3.2.0.
2843    ///
2844    /// ## See also
2845    /// - [`SDL_strlen`]
2846    /// - [`SDL_utf8strlen`]
2847    /// - [`SDL_utf8strnlen`]
2848    pub fn SDL_strnlen(
2849        str: *const ::core::ffi::c_char,
2850        maxlen: ::core::primitive::usize,
2851    ) -> ::core::primitive::usize;
2852}
2853
2854unsafe extern "C" {
2855    /// Copy a string.
2856    ///
2857    /// This function copies up to `maxlen` - 1 characters from `src` to `dst`,
2858    /// then appends a null terminator.
2859    ///
2860    /// If `maxlen` is 0, no characters are copied and no null terminator is
2861    /// written.
2862    ///
2863    /// If you want to copy an UTF-8 string but need to ensure that multi-byte
2864    /// sequences are not truncated, consider using [`SDL_utf8strlcpy()`].
2865    ///
2866    /// ## Parameters
2867    /// - `dst`: The destination buffer. Must not be NULL, and must not overlap
2868    ///   with `src`.
2869    /// - `src`: The null-terminated string to copy. Must not be NULL, and must
2870    ///   not overlap with `dst`.
2871    /// - `maxlen`: The length (in characters) of the destination buffer.
2872    ///
2873    /// ## Return value
2874    /// Returns the length (in characters, excluding the null terminator) of
2875    ///   `src`.
2876    ///
2877    /// ## Thread safety
2878    /// It is safe to call this function from any thread.
2879    ///
2880    /// ## Availability
2881    /// This function is available since SDL 3.2.0.
2882    ///
2883    /// ## See also
2884    /// - [`SDL_strlcat`]
2885    /// - [`SDL_utf8strlcpy`]
2886    pub fn SDL_strlcpy(
2887        dst: *mut ::core::ffi::c_char,
2888        src: *const ::core::ffi::c_char,
2889        maxlen: ::core::primitive::usize,
2890    ) -> ::core::primitive::usize;
2891}
2892
2893unsafe extern "C" {
2894    /// Copy an UTF-8 string.
2895    ///
2896    /// This function copies up to `dst_bytes` - 1 bytes from `src` to `dst` while
2897    /// also ensuring that the string written to `dst` does not end in a truncated
2898    /// multi-byte sequence. Finally, it appends a null terminator.
2899    ///
2900    /// `src` and `dst` must not overlap.
2901    ///
2902    /// Note that unlike [`SDL_strlcpy()`], this function returns the number of bytes
2903    /// written, not the length of `src`.
2904    ///
2905    /// ## Parameters
2906    /// - `dst`: The destination buffer. Must not be NULL, and must not overlap
2907    ///   with `src`.
2908    /// - `src`: The null-terminated UTF-8 string to copy. Must not be NULL, and
2909    ///   must not overlap with `dst`.
2910    /// - `dst_bytes`: The length (in bytes) of the destination buffer. Must not
2911    ///   be 0.
2912    ///
2913    /// ## Return value
2914    /// Returns the number of bytes written, excluding the null terminator.
2915    ///
2916    /// ## Thread safety
2917    /// It is safe to call this function from any thread.
2918    ///
2919    /// ## Availability
2920    /// This function is available since SDL 3.2.0.
2921    ///
2922    /// ## See also
2923    /// - [`SDL_strlcpy`]
2924    pub fn SDL_utf8strlcpy(
2925        dst: *mut ::core::ffi::c_char,
2926        src: *const ::core::ffi::c_char,
2927        dst_bytes: ::core::primitive::usize,
2928    ) -> ::core::primitive::usize;
2929}
2930
2931unsafe extern "C" {
2932    /// Concatenate strings.
2933    ///
2934    /// This function appends up to `maxlen` - SDL_strlen(dst) - 1 characters from
2935    /// `src` to the end of the string in `dst`, then appends a null terminator.
2936    ///
2937    /// `src` and `dst` must not overlap.
2938    ///
2939    /// If `maxlen` - SDL_strlen(dst) - 1 is less than or equal to 0, then `dst` is
2940    /// unmodified.
2941    ///
2942    /// ## Parameters
2943    /// - `dst`: The destination buffer already containing the first
2944    ///   null-terminated string. Must not be NULL and must not overlap
2945    ///   with `src`.
2946    /// - `src`: The second null-terminated string. Must not be NULL, and must
2947    ///   not overlap with `dst`.
2948    /// - `maxlen`: The length (in characters) of the destination buffer.
2949    ///
2950    /// ## Return value
2951    /// Returns the length (in characters, excluding the null terminator) of the
2952    ///   string in `dst` plus the length of `src`.
2953    ///
2954    /// ## Thread safety
2955    /// It is safe to call this function from any thread.
2956    ///
2957    /// ## Availability
2958    /// This function is available since SDL 3.2.0.
2959    ///
2960    /// ## See also
2961    /// - [`SDL_strlcpy`]
2962    pub fn SDL_strlcat(
2963        dst: *mut ::core::ffi::c_char,
2964        src: *const ::core::ffi::c_char,
2965        maxlen: ::core::primitive::usize,
2966    ) -> ::core::primitive::usize;
2967}
2968
2969unsafe extern "C" {
2970    /// Allocate a copy of a string.
2971    ///
2972    /// This allocates enough space for a null-terminated copy of `str`, using
2973    /// [`SDL_malloc`], and then makes a copy of the string into this space.
2974    ///
2975    /// The returned string is owned by the caller, and should be passed to
2976    /// [`SDL_free`] when no longer needed.
2977    ///
2978    /// ## Parameters
2979    /// - `str`: the string to copy.
2980    ///
2981    /// ## Return value
2982    /// Returns a pointer to the newly-allocated string.
2983    ///
2984    /// ## Thread safety
2985    /// It is safe to call this function from any thread.
2986    ///
2987    /// ## Availability
2988    /// This function is available since SDL 3.2.0.
2989    pub fn SDL_strdup(str: *const ::core::ffi::c_char) -> *mut ::core::ffi::c_char;
2990}
2991
2992unsafe extern "C" {
2993    /// Allocate a copy of a string, up to n characters.
2994    ///
2995    /// This allocates enough space for a null-terminated copy of `str`, up to
2996    /// `maxlen` bytes, using [`SDL_malloc`], and then makes a copy of the string into
2997    /// this space.
2998    ///
2999    /// If the string is longer than `maxlen` bytes, the returned string will be
3000    /// `maxlen` bytes long, plus a null-terminator character that isn't included
3001    /// in the count.
3002    ///
3003    /// The returned string is owned by the caller, and should be passed to
3004    /// [`SDL_free`] when no longer needed.
3005    ///
3006    /// ## Parameters
3007    /// - `str`: the string to copy.
3008    /// - `maxlen`: the maximum length of the copied string, not counting the
3009    ///   null-terminator character.
3010    ///
3011    /// ## Return value
3012    /// Returns a pointer to the newly-allocated string.
3013    ///
3014    /// ## Thread safety
3015    /// It is safe to call this function from any thread.
3016    ///
3017    /// ## Availability
3018    /// This function is available since SDL 3.2.0.
3019    pub fn SDL_strndup(
3020        str: *const ::core::ffi::c_char,
3021        maxlen: ::core::primitive::usize,
3022    ) -> *mut ::core::ffi::c_char;
3023}
3024
3025unsafe extern "C" {
3026    /// Reverse a string's contents.
3027    ///
3028    /// This reverses a null-terminated string in-place. Only the content of the
3029    /// string is reversed; the null-terminator character remains at the end of the
3030    /// reversed string.
3031    ///
3032    /// **WARNING**: This function reverses the _bytes_ of the string, not the
3033    /// codepoints. If `str` is a UTF-8 string with Unicode codepoints > 127, this
3034    /// will ruin the string data. You should only use this function on strings
3035    /// that are completely comprised of low ASCII characters.
3036    ///
3037    /// ## Parameters
3038    /// - `str`: the string to reverse.
3039    ///
3040    /// ## Return value
3041    /// Returns `str`.
3042    ///
3043    /// ## Thread safety
3044    /// It is safe to call this function from any thread.
3045    ///
3046    /// ## Availability
3047    /// This function is available since SDL 3.2.0.
3048    pub fn SDL_strrev(str: *mut ::core::ffi::c_char) -> *mut ::core::ffi::c_char;
3049}
3050
3051unsafe extern "C" {
3052    /// Convert a string to uppercase.
3053    ///
3054    /// **WARNING**: Regardless of system locale, this will only convert ASCII
3055    /// values 'A' through 'Z' to uppercase.
3056    ///
3057    /// This function operates on a null-terminated string of bytes--even if it is
3058    /// malformed UTF-8!--and converts ASCII characters 'a' through 'z' to their
3059    /// uppercase equivalents in-place, returning the original `str` pointer.
3060    ///
3061    /// ## Parameters
3062    /// - `str`: the string to convert in-place. Can not be NULL.
3063    ///
3064    /// ## Return value
3065    /// Returns the `str` pointer passed into this function.
3066    ///
3067    /// ## Thread safety
3068    /// It is safe to call this function from any thread.
3069    ///
3070    /// ## Availability
3071    /// This function is available since SDL 3.2.0.
3072    ///
3073    /// ## See also
3074    /// - [`SDL_strlwr`]
3075    pub fn SDL_strupr(str: *mut ::core::ffi::c_char) -> *mut ::core::ffi::c_char;
3076}
3077
3078unsafe extern "C" {
3079    /// Convert a string to lowercase.
3080    ///
3081    /// **WARNING**: Regardless of system locale, this will only convert ASCII
3082    /// values 'A' through 'Z' to lowercase.
3083    ///
3084    /// This function operates on a null-terminated string of bytes--even if it is
3085    /// malformed UTF-8!--and converts ASCII characters 'A' through 'Z' to their
3086    /// lowercase equivalents in-place, returning the original `str` pointer.
3087    ///
3088    /// ## Parameters
3089    /// - `str`: the string to convert in-place. Can not be NULL.
3090    ///
3091    /// ## Return value
3092    /// Returns the `str` pointer passed into this function.
3093    ///
3094    /// ## Thread safety
3095    /// It is safe to call this function from any thread.
3096    ///
3097    /// ## Availability
3098    /// This function is available since SDL 3.2.0.
3099    ///
3100    /// ## See also
3101    /// - [`SDL_strupr`]
3102    pub fn SDL_strlwr(str: *mut ::core::ffi::c_char) -> *mut ::core::ffi::c_char;
3103}
3104
3105unsafe extern "C" {
3106    /// Search a string for the first instance of a specific byte.
3107    ///
3108    /// The search ends once it finds the requested byte value, or a null
3109    /// terminator byte to end the string.
3110    ///
3111    /// Note that this looks for _bytes_, not _characters_, so you cannot match
3112    /// against a Unicode codepoint > 255, regardless of character encoding.
3113    ///
3114    /// ## Parameters
3115    /// - `str`: the string to search. Must not be NULL.
3116    /// - `c`: the byte value to search for.
3117    ///
3118    /// ## Return value
3119    /// Returns a pointer to the first instance of `c` in the string, or NULL if
3120    ///   not found.
3121    ///
3122    /// ## Thread safety
3123    /// It is safe to call this function from any thread.
3124    ///
3125    /// ## Availability
3126    /// This function is available since SDL 3.2.0.
3127    pub fn SDL_strchr(
3128        str: *const ::core::ffi::c_char,
3129        c: ::core::ffi::c_int,
3130    ) -> *mut ::core::ffi::c_char;
3131}
3132
3133unsafe extern "C" {
3134    /// Search a string for the last instance of a specific byte.
3135    ///
3136    /// The search must go until it finds a null terminator byte to end the string.
3137    ///
3138    /// Note that this looks for _bytes_, not _characters_, so you cannot match
3139    /// against a Unicode codepoint > 255, regardless of character encoding.
3140    ///
3141    /// ## Parameters
3142    /// - `str`: the string to search. Must not be NULL.
3143    /// - `c`: the byte value to search for.
3144    ///
3145    /// ## Return value
3146    /// Returns a pointer to the last instance of `c` in the string, or NULL if
3147    ///   not found.
3148    ///
3149    /// ## Thread safety
3150    /// It is safe to call this function from any thread.
3151    ///
3152    /// ## Availability
3153    /// This function is available since SDL 3.2.0.
3154    pub fn SDL_strrchr(
3155        str: *const ::core::ffi::c_char,
3156        c: ::core::ffi::c_int,
3157    ) -> *mut ::core::ffi::c_char;
3158}
3159
3160unsafe extern "C" {
3161    /// Search a string for the first instance of a specific substring.
3162    ///
3163    /// The search ends once it finds the requested substring, or a null terminator
3164    /// byte to end the string.
3165    ///
3166    /// Note that this looks for strings of _bytes_, not _characters_, so it's
3167    /// legal to search for malformed and incomplete UTF-8 sequences.
3168    ///
3169    /// ## Parameters
3170    /// - `haystack`: the string to search. Must not be NULL.
3171    /// - `needle`: the string to search for. Must not be NULL.
3172    ///
3173    /// ## Return value
3174    /// Returns a pointer to the first instance of `needle` in the string, or NULL
3175    ///   if not found.
3176    ///
3177    /// ## Thread safety
3178    /// It is safe to call this function from any thread.
3179    ///
3180    /// ## Availability
3181    /// This function is available since SDL 3.2.0.
3182    pub fn SDL_strstr(
3183        haystack: *const ::core::ffi::c_char,
3184        needle: *const ::core::ffi::c_char,
3185    ) -> *mut ::core::ffi::c_char;
3186}
3187
3188unsafe extern "C" {
3189    /// Search a string, up to n bytes, for the first instance of a specific
3190    /// substring.
3191    ///
3192    /// The search ends once it finds the requested substring, or a null terminator
3193    /// byte to end the string, or `maxlen` bytes have been examined. It is
3194    /// possible to use this function on a string without a null terminator.
3195    ///
3196    /// Note that this looks for strings of _bytes_, not _characters_, so it's
3197    /// legal to search for malformed and incomplete UTF-8 sequences.
3198    ///
3199    /// ## Parameters
3200    /// - `haystack`: the string to search. Must not be NULL.
3201    /// - `needle`: the string to search for. Must not be NULL.
3202    /// - `maxlen`: the maximum number of bytes to search in `haystack`.
3203    ///
3204    /// ## Return value
3205    /// Returns a pointer to the first instance of `needle` in the string, or NULL
3206    ///   if not found.
3207    ///
3208    /// ## Thread safety
3209    /// It is safe to call this function from any thread.
3210    ///
3211    /// ## Availability
3212    /// This function is available since SDL 3.2.0.
3213    pub fn SDL_strnstr(
3214        haystack: *const ::core::ffi::c_char,
3215        needle: *const ::core::ffi::c_char,
3216        maxlen: ::core::primitive::usize,
3217    ) -> *mut ::core::ffi::c_char;
3218}
3219
3220unsafe extern "C" {
3221    /// Search a UTF-8 string for the first instance of a specific substring,
3222    /// case-insensitively.
3223    ///
3224    /// This will work with Unicode strings, using a technique called
3225    /// "case-folding" to handle the vast majority of case-sensitive human
3226    /// languages regardless of system locale. It can deal with expanding values: a
3227    /// German Eszett character can compare against two ASCII 's' chars and be
3228    /// considered a match, for example. A notable exception: it does not handle
3229    /// the Turkish 'i' character; human language is complicated!
3230    ///
3231    /// Since this handles Unicode, it expects the strings to be well-formed UTF-8
3232    /// and not a null-terminated string of arbitrary bytes. Bytes that are not
3233    /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT
3234    /// CHARACTER), which is to say two strings of random bits may turn out to
3235    /// match if they convert to the same amount of replacement characters.
3236    ///
3237    /// ## Parameters
3238    /// - `haystack`: the string to search. Must not be NULL.
3239    /// - `needle`: the string to search for. Must not be NULL.
3240    ///
3241    /// ## Return value
3242    /// Returns a pointer to the first instance of `needle` in the string, or NULL
3243    ///   if not found.
3244    ///
3245    /// ## Thread safety
3246    /// It is safe to call this function from any thread.
3247    ///
3248    /// ## Availability
3249    /// This function is available since SDL 3.2.0.
3250    pub fn SDL_strcasestr(
3251        haystack: *const ::core::ffi::c_char,
3252        needle: *const ::core::ffi::c_char,
3253    ) -> *mut ::core::ffi::c_char;
3254}
3255
3256unsafe extern "C" {
3257    /// This works exactly like strtok_r() but doesn't require access to a C
3258    /// runtime.
3259    ///
3260    /// Break a string up into a series of tokens.
3261    ///
3262    /// To start tokenizing a new string, `str` should be the non-NULL address of
3263    /// the string to start tokenizing. Future calls to get the next token from the
3264    /// same string should specify a NULL.
3265    ///
3266    /// Note that this function will overwrite pieces of `str` with null chars to
3267    /// split it into tokens. This function cannot be used with const/read-only
3268    /// strings!
3269    ///
3270    /// `saveptr` just needs to point to a `char *` that can be overwritten; SDL
3271    /// will use this to save tokenizing state between calls. It is initialized if
3272    /// `str` is non-NULL, and used to resume tokenizing when `str` is NULL.
3273    ///
3274    /// ## Parameters
3275    /// - `str`: the string to tokenize, or NULL to continue tokenizing.
3276    /// - `delim`: the delimiter string that separates tokens.
3277    /// - `saveptr`: pointer to a char *, used for ongoing state.
3278    ///
3279    /// ## Return value
3280    /// Returns A pointer to the next token, or NULL if no tokens remain.
3281    ///
3282    /// ## Thread safety
3283    /// It is safe to call this function from any thread.
3284    ///
3285    /// ## Availability
3286    /// This function is available since SDL 3.2.0.
3287    pub fn SDL_strtok_r(
3288        str: *mut ::core::ffi::c_char,
3289        delim: *const ::core::ffi::c_char,
3290        saveptr: *mut *mut ::core::ffi::c_char,
3291    ) -> *mut ::core::ffi::c_char;
3292}
3293
3294unsafe extern "C" {
3295    /// Count the number of codepoints in a UTF-8 string.
3296    ///
3297    /// Counts the _codepoints_, not _bytes_, in `str`, excluding the null
3298    /// terminator.
3299    ///
3300    /// If you need to count the bytes in a string instead, consider using
3301    /// [`SDL_strlen()`].
3302    ///
3303    /// Since this handles Unicode, it expects the strings to be well-formed UTF-8
3304    /// and not a null-terminated string of arbitrary bytes. Bytes that are not
3305    /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT
3306    /// CHARACTER), so a malformed or incomplete UTF-8 sequence might increase the
3307    /// count by several replacement characters.
3308    ///
3309    /// ## Parameters
3310    /// - `str`: The null-terminated UTF-8 string to read. Must not be NULL.
3311    ///
3312    /// ## Return value
3313    /// Returns The length (in codepoints, excluding the null terminator) of
3314    ///   `src`.
3315    ///
3316    /// ## Thread safety
3317    /// It is safe to call this function from any thread.
3318    ///
3319    /// ## Availability
3320    /// This function is available since SDL 3.2.0.
3321    ///
3322    /// ## See also
3323    /// - [`SDL_utf8strnlen`]
3324    /// - [`SDL_strlen`]
3325    pub fn SDL_utf8strlen(str: *const ::core::ffi::c_char) -> ::core::primitive::usize;
3326}
3327
3328unsafe extern "C" {
3329    /// Count the number of codepoints in a UTF-8 string, up to n bytes.
3330    ///
3331    /// Counts the _codepoints_, not _bytes_, in `str`, excluding the null
3332    /// terminator.
3333    ///
3334    /// If you need to count the bytes in a string instead, consider using
3335    /// [`SDL_strnlen()`].
3336    ///
3337    /// The counting stops at `bytes` bytes (not codepoints!). This seems
3338    /// counterintuitive, but makes it easy to express the total size of the
3339    /// string's buffer.
3340    ///
3341    /// Since this handles Unicode, it expects the strings to be well-formed UTF-8
3342    /// and not a null-terminated string of arbitrary bytes. Bytes that are not
3343    /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT
3344    /// CHARACTER), so a malformed or incomplete UTF-8 sequence might increase the
3345    /// count by several replacement characters.
3346    ///
3347    /// ## Parameters
3348    /// - `str`: The null-terminated UTF-8 string to read. Must not be NULL.
3349    /// - `bytes`: The maximum amount of bytes to count.
3350    ///
3351    /// ## Return value
3352    /// Returns The length (in codepoints, excluding the null terminator) of `src`
3353    ///   but never more than `maxlen`.
3354    ///
3355    /// ## Thread safety
3356    /// It is safe to call this function from any thread.
3357    ///
3358    /// ## Availability
3359    /// This function is available since SDL 3.2.0.
3360    ///
3361    /// ## See also
3362    /// - [`SDL_utf8strlen`]
3363    /// - [`SDL_strnlen`]
3364    pub fn SDL_utf8strnlen(
3365        str: *const ::core::ffi::c_char,
3366        bytes: ::core::primitive::usize,
3367    ) -> ::core::primitive::usize;
3368}
3369
3370unsafe extern "C" {
3371    /// Convert an integer into a string.
3372    ///
3373    /// This requires a radix to specified for string format. Specifying 10
3374    /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
3375    /// to 36.
3376    ///
3377    /// Note that this function will overflow a buffer if `str` is not large enough
3378    /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or
3379    /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate
3380    /// much more space than you expect to use (and don't forget possible negative
3381    /// signs, null terminator bytes, etc).
3382    ///
3383    /// ## Parameters
3384    /// - `value`: the integer to convert.
3385    /// - `str`: the buffer to write the string into.
3386    /// - `radix`: the radix to use for string generation.
3387    ///
3388    /// ## Return value
3389    /// Returns `str`.
3390    ///
3391    /// ## Thread safety
3392    /// It is safe to call this function from any thread.
3393    ///
3394    /// ## Availability
3395    /// This function is available since SDL 3.2.0.
3396    ///
3397    /// ## See also
3398    /// - [`SDL_uitoa`]
3399    /// - [`SDL_ltoa`]
3400    /// - [`SDL_lltoa`]
3401    pub fn SDL_itoa(
3402        value: ::core::ffi::c_int,
3403        str: *mut ::core::ffi::c_char,
3404        radix: ::core::ffi::c_int,
3405    ) -> *mut ::core::ffi::c_char;
3406}
3407
3408unsafe extern "C" {
3409    /// Convert an unsigned integer into a string.
3410    ///
3411    /// This requires a radix to specified for string format. Specifying 10
3412    /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
3413    /// to 36.
3414    ///
3415    /// Note that this function will overflow a buffer if `str` is not large enough
3416    /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or
3417    /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate
3418    /// much more space than you expect to use (and don't forget null terminator
3419    /// bytes, etc).
3420    ///
3421    /// ## Parameters
3422    /// - `value`: the unsigned integer to convert.
3423    /// - `str`: the buffer to write the string into.
3424    /// - `radix`: the radix to use for string generation.
3425    ///
3426    /// ## Return value
3427    /// Returns `str`.
3428    ///
3429    /// ## Thread safety
3430    /// It is safe to call this function from any thread.
3431    ///
3432    /// ## Availability
3433    /// This function is available since SDL 3.2.0.
3434    ///
3435    /// ## See also
3436    /// - [`SDL_itoa`]
3437    /// - [`SDL_ultoa`]
3438    /// - [`SDL_ulltoa`]
3439    pub fn SDL_uitoa(
3440        value: ::core::ffi::c_uint,
3441        str: *mut ::core::ffi::c_char,
3442        radix: ::core::ffi::c_int,
3443    ) -> *mut ::core::ffi::c_char;
3444}
3445
3446unsafe extern "C" {
3447    /// Convert a long integer into a string.
3448    ///
3449    /// This requires a radix to specified for string format. Specifying 10
3450    /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
3451    /// to 36.
3452    ///
3453    /// Note that this function will overflow a buffer if `str` is not large enough
3454    /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or
3455    /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate
3456    /// much more space than you expect to use (and don't forget possible negative
3457    /// signs, null terminator bytes, etc).
3458    ///
3459    /// ## Parameters
3460    /// - `value`: the long integer to convert.
3461    /// - `str`: the buffer to write the string into.
3462    /// - `radix`: the radix to use for string generation.
3463    ///
3464    /// ## Return value
3465    /// Returns `str`.
3466    ///
3467    /// ## Thread safety
3468    /// It is safe to call this function from any thread.
3469    ///
3470    /// ## Availability
3471    /// This function is available since SDL 3.2.0.
3472    ///
3473    /// ## See also
3474    /// - [`SDL_ultoa`]
3475    /// - [`SDL_itoa`]
3476    /// - [`SDL_lltoa`]
3477    pub fn SDL_ltoa(
3478        value: ::core::ffi::c_long,
3479        str: *mut ::core::ffi::c_char,
3480        radix: ::core::ffi::c_int,
3481    ) -> *mut ::core::ffi::c_char;
3482}
3483
3484unsafe extern "C" {
3485    /// Convert an unsigned long integer into a string.
3486    ///
3487    /// This requires a radix to specified for string format. Specifying 10
3488    /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
3489    /// to 36.
3490    ///
3491    /// Note that this function will overflow a buffer if `str` is not large enough
3492    /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or
3493    /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate
3494    /// much more space than you expect to use (and don't forget null terminator
3495    /// bytes, etc).
3496    ///
3497    /// ## Parameters
3498    /// - `value`: the unsigned long integer to convert.
3499    /// - `str`: the buffer to write the string into.
3500    /// - `radix`: the radix to use for string generation.
3501    ///
3502    /// ## Return value
3503    /// Returns `str`.
3504    ///
3505    /// ## Thread safety
3506    /// It is safe to call this function from any thread.
3507    ///
3508    /// ## Availability
3509    /// This function is available since SDL 3.2.0.
3510    ///
3511    /// ## See also
3512    /// - [`SDL_ltoa`]
3513    /// - [`SDL_uitoa`]
3514    /// - [`SDL_ulltoa`]
3515    pub fn SDL_ultoa(
3516        value: ::core::ffi::c_ulong,
3517        str: *mut ::core::ffi::c_char,
3518        radix: ::core::ffi::c_int,
3519    ) -> *mut ::core::ffi::c_char;
3520}
3521
3522unsafe extern "C" {
3523    /// Convert a long long integer into a string.
3524    ///
3525    /// This requires a radix to specified for string format. Specifying 10
3526    /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
3527    /// to 36.
3528    ///
3529    /// Note that this function will overflow a buffer if `str` is not large enough
3530    /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or
3531    /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate
3532    /// much more space than you expect to use (and don't forget possible negative
3533    /// signs, null terminator bytes, etc).
3534    ///
3535    /// ## Parameters
3536    /// - `value`: the long long integer to convert.
3537    /// - `str`: the buffer to write the string into.
3538    /// - `radix`: the radix to use for string generation.
3539    ///
3540    /// ## Return value
3541    /// Returns `str`.
3542    ///
3543    /// ## Thread safety
3544    /// It is safe to call this function from any thread.
3545    ///
3546    /// ## Availability
3547    /// This function is available since SDL 3.2.0.
3548    ///
3549    /// ## See also
3550    /// - [`SDL_ulltoa`]
3551    /// - [`SDL_itoa`]
3552    /// - [`SDL_ltoa`]
3553    pub fn SDL_lltoa(
3554        value: ::core::ffi::c_longlong,
3555        str: *mut ::core::ffi::c_char,
3556        radix: ::core::ffi::c_int,
3557    ) -> *mut ::core::ffi::c_char;
3558}
3559
3560unsafe extern "C" {
3561    /// Convert an unsigned long long integer into a string.
3562    ///
3563    /// This requires a radix to specified for string format. Specifying 10
3564    /// produces a decimal number, 16 hexadecimal, etc. Must be in the range of 2
3565    /// to 36.
3566    ///
3567    /// Note that this function will overflow a buffer if `str` is not large enough
3568    /// to hold the output! It may be safer to use [`SDL_snprintf`] to clamp output, or
3569    /// [`SDL_asprintf`] to allocate a buffer. Otherwise, it doesn't hurt to allocate
3570    /// much more space than you expect to use (and don't forget null terminator
3571    /// bytes, etc).
3572    ///
3573    /// ## Parameters
3574    /// - `value`: the unsigned long long integer to convert.
3575    /// - `str`: the buffer to write the string into.
3576    /// - `radix`: the radix to use for string generation.
3577    ///
3578    /// ## Return value
3579    /// Returns `str`.
3580    ///
3581    /// ## Thread safety
3582    /// It is safe to call this function from any thread.
3583    ///
3584    /// ## Availability
3585    /// This function is available since SDL 3.2.0.
3586    ///
3587    /// ## See also
3588    /// - [`SDL_lltoa`]
3589    /// - [`SDL_uitoa`]
3590    /// - [`SDL_ultoa`]
3591    pub fn SDL_ulltoa(
3592        value: ::core::ffi::c_ulonglong,
3593        str: *mut ::core::ffi::c_char,
3594        radix: ::core::ffi::c_int,
3595    ) -> *mut ::core::ffi::c_char;
3596}
3597
3598unsafe extern "C" {
3599    /// Parse an `int` from a string.
3600    ///
3601    /// The result of calling `SDL_atoi(str)` is equivalent to
3602    /// `(int)SDL_strtol(str, NULL, 10)`.
3603    ///
3604    /// ## Parameters
3605    /// - `str`: The null-terminated string to read. Must not be NULL.
3606    ///
3607    /// ## Return value
3608    /// Returns the parsed `int`.
3609    ///
3610    /// ## Thread safety
3611    /// It is safe to call this function from any thread.
3612    ///
3613    /// ## Availability
3614    /// This function is available since SDL 3.2.0.
3615    ///
3616    /// ## See also
3617    /// - [`SDL_atof`]
3618    /// - [`SDL_strtol`]
3619    /// - [`SDL_strtoul`]
3620    /// - [`SDL_strtoll`]
3621    /// - [`SDL_strtoull`]
3622    /// - [`SDL_strtod`]
3623    /// - [`SDL_itoa`]
3624    pub fn SDL_atoi(str: *const ::core::ffi::c_char) -> ::core::ffi::c_int;
3625}
3626
3627unsafe extern "C" {
3628    /// Parse a `double` from a string.
3629    ///
3630    /// The result of calling `SDL_atof(str)` is equivalent to `SDL_strtod(str,
3631    /// NULL)`.
3632    ///
3633    /// ## Parameters
3634    /// - `str`: The null-terminated string to read. Must not be NULL.
3635    ///
3636    /// ## Return value
3637    /// Returns the parsed `double`.
3638    ///
3639    /// ## Thread safety
3640    /// It is safe to call this function from any thread.
3641    ///
3642    /// ## Availability
3643    /// This function is available since SDL 3.2.0.
3644    ///
3645    /// ## See also
3646    /// - [`SDL_atoi`]
3647    /// - [`SDL_strtol`]
3648    /// - [`SDL_strtoul`]
3649    /// - [`SDL_strtoll`]
3650    /// - [`SDL_strtoull`]
3651    /// - [`SDL_strtod`]
3652    pub fn SDL_atof(str: *const ::core::ffi::c_char) -> ::core::ffi::c_double;
3653}
3654
3655unsafe extern "C" {
3656    /// Parse a `long` from a string.
3657    ///
3658    /// If `str` starts with whitespace, then those whitespace characters are
3659    /// skipped before attempting to parse the number.
3660    ///
3661    /// If the parsed number does not fit inside a `long`, the result is clamped to
3662    /// the minimum and maximum representable `long` values.
3663    ///
3664    /// ## Parameters
3665    /// - `str`: The null-terminated string to read. Must not be NULL.
3666    /// - `endp`: If not NULL, the address of the first invalid character (i.e.
3667    ///   the next character after the parsed number) will be written to
3668    ///   this pointer.
3669    /// - `base`: The base of the integer to read. Supported values are 0 and 2
3670    ///   to 36 inclusive. If 0, the base will be inferred from the
3671    ///   number's prefix (0x for hexadecimal, 0 for octal, decimal
3672    ///   otherwise).
3673    ///
3674    /// ## Return value
3675    /// Returns the parsed `long`, or 0 if no number could be parsed.
3676    ///
3677    /// ## Thread safety
3678    /// It is safe to call this function from any thread.
3679    ///
3680    /// ## Availability
3681    /// This function is available since SDL 3.2.0.
3682    ///
3683    /// ## See also
3684    /// - [`SDL_atoi`]
3685    /// - [`SDL_atof`]
3686    /// - [`SDL_strtoul`]
3687    /// - [`SDL_strtoll`]
3688    /// - [`SDL_strtoull`]
3689    /// - [`SDL_strtod`]
3690    /// - [`SDL_ltoa`]
3691    /// - [`SDL_wcstol`]
3692    pub fn SDL_strtol(
3693        str: *const ::core::ffi::c_char,
3694        endp: *mut *mut ::core::ffi::c_char,
3695        base: ::core::ffi::c_int,
3696    ) -> ::core::ffi::c_long;
3697}
3698
3699unsafe extern "C" {
3700    /// Parse an `unsigned long` from a string.
3701    ///
3702    /// If `str` starts with whitespace, then those whitespace characters are
3703    /// skipped before attempting to parse the number.
3704    ///
3705    /// If the parsed number does not fit inside an `unsigned long`, the result is
3706    /// clamped to the maximum representable `unsigned long` value.
3707    ///
3708    /// ## Parameters
3709    /// - `str`: The null-terminated string to read. Must not be NULL.
3710    /// - `endp`: If not NULL, the address of the first invalid character (i.e.
3711    ///   the next character after the parsed number) will be written to
3712    ///   this pointer.
3713    /// - `base`: The base of the integer to read. Supported values are 0 and 2
3714    ///   to 36 inclusive. If 0, the base will be inferred from the
3715    ///   number's prefix (0x for hexadecimal, 0 for octal, decimal
3716    ///   otherwise).
3717    ///
3718    /// ## Return value
3719    /// Returns the parsed `unsigned long`, or 0 if no number could be parsed.
3720    ///
3721    /// ## Thread safety
3722    /// It is safe to call this function from any thread.
3723    ///
3724    /// ## Availability
3725    /// This function is available since SDL 3.2.0.
3726    ///
3727    /// ## See also
3728    /// - [`SDL_atoi`]
3729    /// - [`SDL_atof`]
3730    /// - [`SDL_strtol`]
3731    /// - [`SDL_strtoll`]
3732    /// - [`SDL_strtoull`]
3733    /// - [`SDL_strtod`]
3734    /// - [`SDL_ultoa`]
3735    pub fn SDL_strtoul(
3736        str: *const ::core::ffi::c_char,
3737        endp: *mut *mut ::core::ffi::c_char,
3738        base: ::core::ffi::c_int,
3739    ) -> ::core::ffi::c_ulong;
3740}
3741
3742unsafe extern "C" {
3743    /// Parse a `long long` from a string.
3744    ///
3745    /// If `str` starts with whitespace, then those whitespace characters are
3746    /// skipped before attempting to parse the number.
3747    ///
3748    /// If the parsed number does not fit inside a `long long`, the result is
3749    /// clamped to the minimum and maximum representable `long long` values.
3750    ///
3751    /// ## Parameters
3752    /// - `str`: The null-terminated string to read. Must not be NULL.
3753    /// - `endp`: If not NULL, the address of the first invalid character (i.e.
3754    ///   the next character after the parsed number) will be written to
3755    ///   this pointer.
3756    /// - `base`: The base of the integer to read. Supported values are 0 and 2
3757    ///   to 36 inclusive. If 0, the base will be inferred from the
3758    ///   number's prefix (0x for hexadecimal, 0 for octal, decimal
3759    ///   otherwise).
3760    ///
3761    /// ## Return value
3762    /// Returns the parsed `long long`, or 0 if no number could be parsed.
3763    ///
3764    /// ## Thread safety
3765    /// It is safe to call this function from any thread.
3766    ///
3767    /// ## Availability
3768    /// This function is available since SDL 3.2.0.
3769    ///
3770    /// ## See also
3771    /// - [`SDL_atoi`]
3772    /// - [`SDL_atof`]
3773    /// - [`SDL_strtol`]
3774    /// - [`SDL_strtoul`]
3775    /// - [`SDL_strtoull`]
3776    /// - [`SDL_strtod`]
3777    /// - [`SDL_lltoa`]
3778    pub fn SDL_strtoll(
3779        str: *const ::core::ffi::c_char,
3780        endp: *mut *mut ::core::ffi::c_char,
3781        base: ::core::ffi::c_int,
3782    ) -> ::core::ffi::c_longlong;
3783}
3784
3785unsafe extern "C" {
3786    /// Parse an `unsigned long long` from a string.
3787    ///
3788    /// If `str` starts with whitespace, then those whitespace characters are
3789    /// skipped before attempting to parse the number.
3790    ///
3791    /// If the parsed number does not fit inside an `unsigned long long`, the
3792    /// result is clamped to the maximum representable `unsigned long long` value.
3793    ///
3794    /// ## Parameters
3795    /// - `str`: The null-terminated string to read. Must not be NULL.
3796    /// - `endp`: If not NULL, the address of the first invalid character (i.e.
3797    ///   the next character after the parsed number) will be written to
3798    ///   this pointer.
3799    /// - `base`: The base of the integer to read. Supported values are 0 and 2
3800    ///   to 36 inclusive. If 0, the base will be inferred from the
3801    ///   number's prefix (0x for hexadecimal, 0 for octal, decimal
3802    ///   otherwise).
3803    ///
3804    /// ## Return value
3805    /// Returns the parsed `unsigned long long`, or 0 if no number could be
3806    ///   parsed.
3807    ///
3808    /// ## Thread safety
3809    /// It is safe to call this function from any thread.
3810    ///
3811    /// ## Availability
3812    /// This function is available since SDL 3.2.0.
3813    ///
3814    /// ## See also
3815    /// - [`SDL_atoi`]
3816    /// - [`SDL_atof`]
3817    /// - [`SDL_strtol`]
3818    /// - [`SDL_strtoll`]
3819    /// - [`SDL_strtoul`]
3820    /// - [`SDL_strtod`]
3821    /// - [`SDL_ulltoa`]
3822    pub fn SDL_strtoull(
3823        str: *const ::core::ffi::c_char,
3824        endp: *mut *mut ::core::ffi::c_char,
3825        base: ::core::ffi::c_int,
3826    ) -> ::core::ffi::c_ulonglong;
3827}
3828
3829unsafe extern "C" {
3830    /// Parse a `double` from a string.
3831    ///
3832    /// This function makes fewer guarantees than the C runtime `strtod`:
3833    ///
3834    /// - Only decimal notation is guaranteed to be supported. The handling of
3835    ///   scientific and hexadecimal notation is unspecified.
3836    /// - Whether or not INF and NAN can be parsed is unspecified.
3837    /// - The precision of the result is unspecified.
3838    ///
3839    /// ## Parameters
3840    /// - `str`: the null-terminated string to read. Must not be NULL.
3841    /// - `endp`: if not NULL, the address of the first invalid character (i.e.
3842    ///   the next character after the parsed number) will be written to
3843    ///   this pointer.
3844    ///
3845    /// ## Return value
3846    /// Returns the parsed `double`, or 0 if no number could be parsed.
3847    ///
3848    /// ## Thread safety
3849    /// It is safe to call this function from any thread.
3850    ///
3851    /// ## Availability
3852    /// This function is available since SDL 3.2.0.
3853    ///
3854    /// ## See also
3855    /// - [`SDL_atoi`]
3856    /// - [`SDL_atof`]
3857    /// - [`SDL_strtol`]
3858    /// - [`SDL_strtoll`]
3859    /// - [`SDL_strtoul`]
3860    /// - [`SDL_strtoull`]
3861    pub fn SDL_strtod(
3862        str: *const ::core::ffi::c_char,
3863        endp: *mut *mut ::core::ffi::c_char,
3864    ) -> ::core::ffi::c_double;
3865}
3866
3867unsafe extern "C" {
3868    /// Compare two null-terminated UTF-8 strings.
3869    ///
3870    /// Due to the nature of UTF-8 encoding, this will work with Unicode strings,
3871    /// since effectively this function just compares bytes until it hits a
3872    /// null-terminating character. Also due to the nature of UTF-8, this can be
3873    /// used with [`SDL_qsort()`] to put strings in (roughly) alphabetical order.
3874    ///
3875    /// ## Parameters
3876    /// - `str1`: the first string to compare. NULL is not permitted!
3877    /// - `str2`: the second string to compare. NULL is not permitted!
3878    ///
3879    /// ## Return value
3880    /// Returns less than zero if str1 is "less than" str2, greater than zero if
3881    ///   str1 is "greater than" str2, and zero if the strings match
3882    ///   exactly.
3883    ///
3884    /// ## Thread safety
3885    /// It is safe to call this function from any thread.
3886    ///
3887    /// ## Availability
3888    /// This function is available since SDL 3.2.0.
3889    pub fn SDL_strcmp(
3890        str1: *const ::core::ffi::c_char,
3891        str2: *const ::core::ffi::c_char,
3892    ) -> ::core::ffi::c_int;
3893}
3894
3895unsafe extern "C" {
3896    /// Compare two UTF-8 strings up to a number of bytes.
3897    ///
3898    /// Due to the nature of UTF-8 encoding, this will work with Unicode strings,
3899    /// since effectively this function just compares bytes until it hits a
3900    /// null-terminating character. Also due to the nature of UTF-8, this can be
3901    /// used with [`SDL_qsort()`] to put strings in (roughly) alphabetical order.
3902    ///
3903    /// Note that while this function is intended to be used with UTF-8, it is
3904    /// doing a bytewise comparison, and `maxlen` specifies a _byte_ limit! If the
3905    /// limit lands in the middle of a multi-byte UTF-8 sequence, it will only
3906    /// compare a portion of the final character.
3907    ///
3908    /// `maxlen` specifies a maximum number of bytes to compare; if the strings
3909    /// match to this number of bytes (or both have matched to a null-terminator
3910    /// character before this number of bytes), they will be considered equal.
3911    ///
3912    /// ## Parameters
3913    /// - `str1`: the first string to compare. NULL is not permitted!
3914    /// - `str2`: the second string to compare. NULL is not permitted!
3915    /// - `maxlen`: the maximum number of _bytes_ to compare.
3916    ///
3917    /// ## Return value
3918    /// Returns less than zero if str1 is "less than" str2, greater than zero if
3919    ///   str1 is "greater than" str2, and zero if the strings match
3920    ///   exactly.
3921    ///
3922    /// ## Thread safety
3923    /// It is safe to call this function from any thread.
3924    ///
3925    /// ## Availability
3926    /// This function is available since SDL 3.2.0.
3927    pub fn SDL_strncmp(
3928        str1: *const ::core::ffi::c_char,
3929        str2: *const ::core::ffi::c_char,
3930        maxlen: ::core::primitive::usize,
3931    ) -> ::core::ffi::c_int;
3932}
3933
3934unsafe extern "C" {
3935    /// Compare two null-terminated UTF-8 strings, case-insensitively.
3936    ///
3937    /// This will work with Unicode strings, using a technique called
3938    /// "case-folding" to handle the vast majority of case-sensitive human
3939    /// languages regardless of system locale. It can deal with expanding values: a
3940    /// German Eszett character can compare against two ASCII 's' chars and be
3941    /// considered a match, for example. A notable exception: it does not handle
3942    /// the Turkish 'i' character; human language is complicated!
3943    ///
3944    /// Since this handles Unicode, it expects the string to be well-formed UTF-8
3945    /// and not a null-terminated string of arbitrary bytes. Bytes that are not
3946    /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT
3947    /// CHARACTER), which is to say two strings of random bits may turn out to
3948    /// match if they convert to the same amount of replacement characters.
3949    ///
3950    /// ## Parameters
3951    /// - `str1`: the first string to compare. NULL is not permitted!
3952    /// - `str2`: the second string to compare. NULL is not permitted!
3953    ///
3954    /// ## Return value
3955    /// Returns less than zero if str1 is "less than" str2, greater than zero if
3956    ///   str1 is "greater than" str2, and zero if the strings match
3957    ///   exactly.
3958    ///
3959    /// ## Thread safety
3960    /// It is safe to call this function from any thread.
3961    ///
3962    /// ## Availability
3963    /// This function is available since SDL 3.2.0.
3964    pub fn SDL_strcasecmp(
3965        str1: *const ::core::ffi::c_char,
3966        str2: *const ::core::ffi::c_char,
3967    ) -> ::core::ffi::c_int;
3968}
3969
3970unsafe extern "C" {
3971    /// Compare two UTF-8 strings, case-insensitively, up to a number of bytes.
3972    ///
3973    /// This will work with Unicode strings, using a technique called
3974    /// "case-folding" to handle the vast majority of case-sensitive human
3975    /// languages regardless of system locale. It can deal with expanding values: a
3976    /// German Eszett character can compare against two ASCII 's' chars and be
3977    /// considered a match, for example. A notable exception: it does not handle
3978    /// the Turkish 'i' character; human language is complicated!
3979    ///
3980    /// Since this handles Unicode, it expects the string to be well-formed UTF-8
3981    /// and not a null-terminated string of arbitrary bytes. Bytes that are not
3982    /// valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT
3983    /// CHARACTER), which is to say two strings of random bits may turn out to
3984    /// match if they convert to the same amount of replacement characters.
3985    ///
3986    /// Note that while this function is intended to be used with UTF-8, `maxlen`
3987    /// specifies a _byte_ limit! If the limit lands in the middle of a multi-byte
3988    /// UTF-8 sequence, it may convert a portion of the final character to one or
3989    /// more Unicode character U+FFFD (REPLACEMENT CHARACTER) so as not to overflow
3990    /// a buffer.
3991    ///
3992    /// `maxlen` specifies a maximum number of bytes to compare; if the strings
3993    /// match to this number of bytes (or both have matched to a null-terminator
3994    /// character before this number of bytes), they will be considered equal.
3995    ///
3996    /// ## Parameters
3997    /// - `str1`: the first string to compare. NULL is not permitted!
3998    /// - `str2`: the second string to compare. NULL is not permitted!
3999    /// - `maxlen`: the maximum number of bytes to compare.
4000    ///
4001    /// ## Return value
4002    /// Returns less than zero if str1 is "less than" str2, greater than zero if
4003    ///   str1 is "greater than" str2, and zero if the strings match
4004    ///   exactly.
4005    ///
4006    /// ## Thread safety
4007    /// It is safe to call this function from any thread.
4008    ///
4009    /// ## Availability
4010    /// This function is available since SDL 3.2.0.
4011    pub fn SDL_strncasecmp(
4012        str1: *const ::core::ffi::c_char,
4013        str2: *const ::core::ffi::c_char,
4014        maxlen: ::core::primitive::usize,
4015    ) -> ::core::ffi::c_int;
4016}
4017
4018unsafe extern "C" {
4019    /// Searches a string for the first occurrence of any character contained in a
4020    /// breakset, and returns a pointer from the string to that character.
4021    ///
4022    /// ## Parameters
4023    /// - `str`: The null-terminated string to be searched. Must not be NULL, and
4024    ///   must not overlap with `breakset`.
4025    /// - `breakset`: A null-terminated string containing the list of characters
4026    ///   to look for. Must not be NULL, and must not overlap with
4027    ///   `str`.
4028    ///
4029    /// ## Return value
4030    /// Returns A pointer to the location, in str, of the first occurrence of a
4031    ///   character present in the breakset, or NULL if none is found.
4032    ///
4033    /// ## Thread safety
4034    /// It is safe to call this function from any thread.
4035    ///
4036    /// ## Availability
4037    /// This function is available since SDL 3.2.0.
4038    pub fn SDL_strpbrk(
4039        str: *const ::core::ffi::c_char,
4040        breakset: *const ::core::ffi::c_char,
4041    ) -> *mut ::core::ffi::c_char;
4042}
4043
4044/// The Unicode REPLACEMENT CHARACTER codepoint.
4045///
4046/// [`SDL_StepUTF8()`] and [`SDL_StepBackUTF8()`] report this codepoint when they
4047/// encounter a UTF-8 string with encoding errors.
4048///
4049/// This tends to render as something like a question mark in most places.
4050///
4051/// ## Availability
4052/// This macro is available since SDL 3.2.0.
4053///
4054/// ## See also
4055/// - [`SDL_StepBackUTF8`]
4056/// - [`SDL_StepUTF8`]
4057pub const SDL_INVALID_UNICODE_CODEPOINT: ::core::primitive::i32 = 65533;
4058
4059unsafe extern "C" {
4060    /// Decode a UTF-8 string, one Unicode codepoint at a time.
4061    ///
4062    /// This will return the first Unicode codepoint in the UTF-8 encoded string in
4063    /// `*pstr`, and then advance `*pstr` past any consumed bytes before returning.
4064    ///
4065    /// It will not access more than `*pslen` bytes from the string. `*pslen` will
4066    /// be adjusted, as well, subtracting the number of bytes consumed.
4067    ///
4068    /// `pslen` is allowed to be NULL, in which case the string _must_ be
4069    /// NULL-terminated, as the function will blindly read until it sees the NULL
4070    /// char.
4071    ///
4072    /// if `*pslen` is zero, it assumes the end of string is reached and returns a
4073    /// zero codepoint regardless of the contents of the string buffer.
4074    ///
4075    /// If the resulting codepoint is zero (a NULL terminator), or `*pslen` is
4076    /// zero, it will not advance `*pstr` or `*pslen` at all.
4077    ///
4078    /// Generally this function is called in a loop until it returns zero,
4079    /// adjusting its parameters each iteration.
4080    ///
4081    /// If an invalid UTF-8 sequence is encountered, this function returns
4082    /// [`SDL_INVALID_UNICODE_CODEPOINT`] and advances the string/length by one byte
4083    /// (which is to say, a multibyte sequence might produce several
4084    /// [`SDL_INVALID_UNICODE_CODEPOINT`] returns before it syncs to the next valid
4085    /// UTF-8 sequence).
4086    ///
4087    /// Several things can generate invalid UTF-8 sequences, including overlong
4088    /// encodings, the use of UTF-16 surrogate values, and truncated data. Please
4089    /// refer to
4090    /// [RFC3629](https://www.ietf.org/rfc/rfc3629.txt)
4091    /// for details.
4092    ///
4093    /// ## Parameters
4094    /// - `pstr`: a pointer to a UTF-8 string pointer to be read and adjusted.
4095    /// - `pslen`: a pointer to the number of bytes in the string, to be read and
4096    ///   adjusted. NULL is allowed.
4097    ///
4098    /// ## Return value
4099    /// Returns the first Unicode codepoint in the string.
4100    ///
4101    /// ## Thread safety
4102    /// It is safe to call this function from any thread.
4103    ///
4104    /// ## Availability
4105    /// This function is available since SDL 3.2.0.
4106    pub fn SDL_StepUTF8(
4107        pstr: *mut *const ::core::ffi::c_char,
4108        pslen: *mut ::core::primitive::usize,
4109    ) -> Uint32;
4110}
4111
4112unsafe extern "C" {
4113    /// Decode a UTF-8 string in reverse, one Unicode codepoint at a time.
4114    ///
4115    /// This will go to the start of the previous Unicode codepoint in the string,
4116    /// move `*pstr` to that location and return that codepoint.
4117    ///
4118    /// If `*pstr` is already at the start of the string), it will not advance
4119    /// `*pstr` at all.
4120    ///
4121    /// Generally this function is called in a loop until it returns zero,
4122    /// adjusting its parameter each iteration.
4123    ///
4124    /// If an invalid UTF-8 sequence is encountered, this function returns
4125    /// [`SDL_INVALID_UNICODE_CODEPOINT`].
4126    ///
4127    /// Several things can generate invalid UTF-8 sequences, including overlong
4128    /// encodings, the use of UTF-16 surrogate values, and truncated data. Please
4129    /// refer to
4130    /// [RFC3629](https://www.ietf.org/rfc/rfc3629.txt)
4131    /// for details.
4132    ///
4133    /// ## Parameters
4134    /// - `start`: a pointer to the beginning of the UTF-8 string.
4135    /// - `pstr`: a pointer to a UTF-8 string pointer to be read and adjusted.
4136    ///
4137    /// ## Return value
4138    /// Returns the previous Unicode codepoint in the string.
4139    ///
4140    /// ## Thread safety
4141    /// It is safe to call this function from any thread.
4142    ///
4143    /// ## Availability
4144    /// This function is available since SDL 3.2.0.
4145    pub fn SDL_StepBackUTF8(
4146        start: *const ::core::ffi::c_char,
4147        pstr: *mut *const ::core::ffi::c_char,
4148    ) -> Uint32;
4149}
4150
4151unsafe extern "C" {
4152    /// Convert a single Unicode codepoint to UTF-8.
4153    ///
4154    /// The buffer pointed to by `dst` must be at least 4 bytes long, as this
4155    /// function may generate between 1 and 4 bytes of output.
4156    ///
4157    /// This function returns the first byte _after_ the newly-written UTF-8
4158    /// sequence, which is useful for encoding multiple codepoints in a loop, or
4159    /// knowing where to write a NULL-terminator character to end the string (in
4160    /// either case, plan to have a buffer of _more_ than 4 bytes!).
4161    ///
4162    /// If `codepoint` is an invalid value (outside the Unicode range, or a UTF-16
4163    /// surrogate value, etc), this will use U+FFFD (REPLACEMENT CHARACTER) for the
4164    /// codepoint instead, and not set an error.
4165    ///
4166    /// If `dst` is NULL, this returns NULL immediately without writing to the
4167    /// pointer and without setting an error.
4168    ///
4169    /// ## Parameters
4170    /// - `codepoint`: a Unicode codepoint to convert to UTF-8.
4171    /// - `dst`: the location to write the encoded UTF-8. Must point to at least
4172    ///   4 bytes!
4173    ///
4174    /// ## Return value
4175    /// Returns the first byte past the newly-written UTF-8 sequence.
4176    ///
4177    /// ## Thread safety
4178    /// It is safe to call this function from any thread.
4179    ///
4180    /// ## Availability
4181    /// This function is available since SDL 3.2.0.
4182    pub fn SDL_UCS4ToUTF8(
4183        codepoint: Uint32,
4184        dst: *mut ::core::ffi::c_char,
4185    ) -> *mut ::core::ffi::c_char;
4186}
4187
4188unsafe extern "C" {
4189    /// This works exactly like sscanf() but doesn't require access to a C runtime.
4190    ///
4191    /// Scan a string, matching a format string, converting each '%' item and
4192    /// storing it to pointers provided through variable arguments.
4193    ///
4194    /// ## Parameters
4195    /// - `text`: the string to scan. Must not be NULL.
4196    /// - `fmt`: a printf-style format string. Must not be NULL.
4197    /// - `...`: a list of pointers to values to be filled in with scanned items.
4198    ///
4199    /// ## Return value
4200    /// Returns the number of items that matched the format string.
4201    ///
4202    /// ## Thread safety
4203    /// It is safe to call this function from any thread.
4204    ///
4205    /// ## Availability
4206    /// This function is available since SDL 3.2.0.
4207    pub fn SDL_sscanf(
4208        text: *const ::core::ffi::c_char,
4209        fmt: *const ::core::ffi::c_char,
4210        ...
4211    ) -> ::core::ffi::c_int;
4212}
4213
4214unsafe extern "C" {
4215    /// This works exactly like vsscanf() but doesn't require access to a C
4216    /// runtime.
4217    ///
4218    /// Functions identically to [`SDL_sscanf()`], except it takes a `va_list` instead
4219    /// of using `...` variable arguments.
4220    ///
4221    /// ## Parameters
4222    /// - `text`: the string to scan. Must not be NULL.
4223    /// - `fmt`: a printf-style format string. Must not be NULL.
4224    /// - `ap`: a `va_list` of pointers to values to be filled in with scanned
4225    ///   items.
4226    ///
4227    /// ## Return value
4228    /// Returns the number of items that matched the format string.
4229    ///
4230    /// ## Thread safety
4231    /// It is safe to call this function from any thread.
4232    ///
4233    /// ## Availability
4234    /// This function is available since SDL 3.2.0.
4235    pub fn SDL_vsscanf(
4236        text: *const ::core::ffi::c_char,
4237        fmt: *const ::core::ffi::c_char,
4238        ap: crate::ffi::VaList,
4239    ) -> ::core::ffi::c_int;
4240}
4241
4242unsafe extern "C" {
4243    /// This works exactly like snprintf() but doesn't require access to a C
4244    /// runtime.
4245    ///
4246    /// Format a string of up to `maxlen`-1 bytes, converting each '%' item with
4247    /// values provided through variable arguments.
4248    ///
4249    /// While some C runtimes differ on how to deal with too-large strings, this
4250    /// function null-terminates the output, by treating the null-terminator as
4251    /// part of the `maxlen` count. Note that if `maxlen` is zero, however, no
4252    /// bytes will be written at all.
4253    ///
4254    /// This function returns the number of _bytes_ (not _characters_) that should
4255    /// be written, excluding the null-terminator character. If this returns a
4256    /// number >= `maxlen`, it means the output string was truncated. A negative
4257    /// return value means an error occurred.
4258    ///
4259    /// Referencing the output string's pointer with a format item is undefined
4260    /// behavior.
4261    ///
4262    /// ## Parameters
4263    /// - `text`: the buffer to write the string into. Must not be NULL.
4264    /// - `maxlen`: the maximum bytes to write, including the null-terminator.
4265    /// - `fmt`: a printf-style format string. Must not be NULL.
4266    /// - `...`: a list of values to be used with the format string.
4267    ///
4268    /// ## Return value
4269    /// Returns the number of bytes that should be written, not counting the
4270    ///   null-terminator char, or a negative value on error.
4271    ///
4272    /// ## Thread safety
4273    /// It is safe to call this function from any thread.
4274    ///
4275    /// ## Availability
4276    /// This function is available since SDL 3.2.0.
4277    pub fn SDL_snprintf(
4278        text: *mut ::core::ffi::c_char,
4279        maxlen: ::core::primitive::usize,
4280        fmt: *const ::core::ffi::c_char,
4281        ...
4282    ) -> ::core::ffi::c_int;
4283}
4284
4285unsafe extern "C" {
4286    /// This works exactly like swprintf() but doesn't require access to a C
4287    /// runtime.
4288    ///
4289    /// Format a wide string of up to `maxlen`-1 wchar_t values, converting each
4290    /// '%' item with values provided through variable arguments.
4291    ///
4292    /// While some C runtimes differ on how to deal with too-large strings, this
4293    /// function null-terminates the output, by treating the null-terminator as
4294    /// part of the `maxlen` count. Note that if `maxlen` is zero, however, no wide
4295    /// characters will be written at all.
4296    ///
4297    /// This function returns the number of _wide characters_ (not _codepoints_)
4298    /// that should be written, excluding the null-terminator character. If this
4299    /// returns a number >= `maxlen`, it means the output string was truncated. A
4300    /// negative return value means an error occurred.
4301    ///
4302    /// Referencing the output string's pointer with a format item is undefined
4303    /// behavior.
4304    ///
4305    /// ## Parameters
4306    /// - `text`: the buffer to write the wide string into. Must not be NULL.
4307    /// - `maxlen`: the maximum wchar_t values to write, including the
4308    ///   null-terminator.
4309    /// - `fmt`: a printf-style format string. Must not be NULL.
4310    /// - `...`: a list of values to be used with the format string.
4311    ///
4312    /// ## Return value
4313    /// Returns the number of wide characters that should be written, not counting
4314    ///   the null-terminator char, or a negative value on error.
4315    ///
4316    /// ## Thread safety
4317    /// It is safe to call this function from any thread.
4318    ///
4319    /// ## Availability
4320    /// This function is available since SDL 3.2.0.
4321    pub fn SDL_swprintf(
4322        text: *mut crate::ffi::c_wchar_t,
4323        maxlen: ::core::primitive::usize,
4324        fmt: *const crate::ffi::c_wchar_t,
4325        ...
4326    ) -> ::core::ffi::c_int;
4327}
4328
4329unsafe extern "C" {
4330    /// This works exactly like vsnprintf() but doesn't require access to a C
4331    /// runtime.
4332    ///
4333    /// Functions identically to [`SDL_snprintf()`], except it takes a `va_list`
4334    /// instead of using `...` variable arguments.
4335    ///
4336    /// ## Parameters
4337    /// - `text`: the buffer to write the string into. Must not be NULL.
4338    /// - `maxlen`: the maximum bytes to write, including the null-terminator.
4339    /// - `fmt`: a printf-style format string. Must not be NULL.
4340    /// - `ap`: a `va_list` values to be used with the format string.
4341    ///
4342    /// ## Return value
4343    /// Returns the number of bytes that should be written, not counting the
4344    ///   null-terminator char, or a negative value on error.
4345    ///
4346    /// ## Thread safety
4347    /// It is safe to call this function from any thread.
4348    ///
4349    /// ## Availability
4350    /// This function is available since SDL 3.2.0.
4351    pub fn SDL_vsnprintf(
4352        text: *mut ::core::ffi::c_char,
4353        maxlen: ::core::primitive::usize,
4354        fmt: *const ::core::ffi::c_char,
4355        ap: crate::ffi::VaList,
4356    ) -> ::core::ffi::c_int;
4357}
4358
4359unsafe extern "C" {
4360    /// This works exactly like vswprintf() but doesn't require access to a C
4361    /// runtime.
4362    ///
4363    /// Functions identically to [`SDL_swprintf()`], except it takes a `va_list`
4364    /// instead of using `...` variable arguments.
4365    ///
4366    /// ## Parameters
4367    /// - `text`: the buffer to write the string into. Must not be NULL.
4368    /// - `maxlen`: the maximum wide characters to write, including the
4369    ///   null-terminator.
4370    /// - `fmt`: a printf-style format wide string. Must not be NULL.
4371    /// - `ap`: a `va_list` values to be used with the format string.
4372    ///
4373    /// ## Return value
4374    /// Returns the number of wide characters that should be written, not counting
4375    ///   the null-terminator char, or a negative value on error.
4376    ///
4377    /// ## Thread safety
4378    /// It is safe to call this function from any thread.
4379    ///
4380    /// ## Availability
4381    /// This function is available since SDL 3.2.0.
4382    pub fn SDL_vswprintf(
4383        text: *mut crate::ffi::c_wchar_t,
4384        maxlen: ::core::primitive::usize,
4385        fmt: *const crate::ffi::c_wchar_t,
4386        ap: crate::ffi::VaList,
4387    ) -> ::core::ffi::c_int;
4388}
4389
4390unsafe extern "C" {
4391    /// This works exactly like asprintf() but doesn't require access to a C
4392    /// runtime.
4393    ///
4394    /// Functions identically to [`SDL_snprintf()`], except it allocates a buffer large
4395    /// enough to hold the output string on behalf of the caller.
4396    ///
4397    /// On success, this function returns the number of bytes (not characters)
4398    /// comprising the output string, not counting the null-terminator character,
4399    /// and sets `*strp` to the newly-allocated string.
4400    ///
4401    /// On error, this function returns a negative number, and the value of `*strp`
4402    /// is undefined.
4403    ///
4404    /// The returned string is owned by the caller, and should be passed to
4405    /// [`SDL_free`] when no longer needed.
4406    ///
4407    /// ## Parameters
4408    /// - `strp`: on output, is set to the new string. Must not be NULL.
4409    /// - `fmt`: a printf-style format string. Must not be NULL.
4410    /// - `...`: a list of values to be used with the format string.
4411    ///
4412    /// ## Return value
4413    /// Returns the number of bytes in the newly-allocated string, not counting
4414    ///   the null-terminator char, or a negative value on error.
4415    ///
4416    /// ## Thread safety
4417    /// It is safe to call this function from any thread.
4418    ///
4419    /// ## Availability
4420    /// This function is available since SDL 3.2.0.
4421    pub fn SDL_asprintf(
4422        strp: *mut *mut ::core::ffi::c_char,
4423        fmt: *const ::core::ffi::c_char,
4424        ...
4425    ) -> ::core::ffi::c_int;
4426}
4427
4428unsafe extern "C" {
4429    /// This works exactly like vasprintf() but doesn't require access to a C
4430    /// runtime.
4431    ///
4432    /// Functions identically to [`SDL_asprintf()`], except it takes a `va_list`
4433    /// instead of using `...` variable arguments.
4434    ///
4435    /// ## Parameters
4436    /// - `strp`: on output, is set to the new string. Must not be NULL.
4437    /// - `fmt`: a printf-style format string. Must not be NULL.
4438    /// - `ap`: a `va_list` values to be used with the format string.
4439    ///
4440    /// ## Return value
4441    /// Returns the number of bytes in the newly-allocated string, not counting
4442    ///   the null-terminator char, or a negative value on error.
4443    ///
4444    /// ## Thread safety
4445    /// It is safe to call this function from any thread.
4446    ///
4447    /// ## Availability
4448    /// This function is available since SDL 3.2.0.
4449    pub fn SDL_vasprintf(
4450        strp: *mut *mut ::core::ffi::c_char,
4451        fmt: *const ::core::ffi::c_char,
4452        ap: crate::ffi::VaList,
4453    ) -> ::core::ffi::c_int;
4454}
4455
4456unsafe extern "C" {
4457    /// Seeds the pseudo-random number generator.
4458    ///
4459    /// Reusing the seed number will cause [`SDL_rand()`] to repeat the same stream of
4460    /// 'random' numbers.
4461    ///
4462    /// ## Parameters
4463    /// - `seed`: the value to use as a random number seed, or 0 to use
4464    ///   [`SDL_GetPerformanceCounter()`].
4465    ///
4466    /// ## Thread safety
4467    /// This should be called on the same thread that calls
4468    ///   [`SDL_rand()`]
4469    ///
4470    /// ## Availability
4471    /// This function is available since SDL 3.2.0.
4472    ///
4473    /// ## See also
4474    /// - [`SDL_rand`]
4475    /// - [`SDL_rand_bits`]
4476    /// - [`SDL_randf`]
4477    pub fn SDL_srand(seed: Uint64);
4478}
4479
4480unsafe extern "C" {
4481    /// Generate a pseudo-random number less than n for positive n
4482    ///
4483    /// The method used is faster and of better quality than `rand() % n`. Odds are
4484    /// roughly 99.9% even for n = 1 million. Evenness is better for smaller n, and
4485    /// much worse as n gets bigger.
4486    ///
4487    /// Example: to simulate a d6 use `SDL_rand(6) + 1` The +1 converts 0..5 to
4488    /// 1..6
4489    ///
4490    /// If you want to generate a pseudo-random number in the full range of Sint32,
4491    /// you should use: (Sint32)SDL_rand_bits()
4492    ///
4493    /// If you want reproducible output, be sure to initialize with [`SDL_srand()`]
4494    /// first.
4495    ///
4496    /// There are no guarantees as to the quality of the random sequence produced,
4497    /// and this should not be used for security (cryptography, passwords) or where
4498    /// money is on the line (loot-boxes, casinos). There are many random number
4499    /// libraries available with different characteristics and you should pick one
4500    /// of those to meet any serious needs.
4501    ///
4502    /// ## Parameters
4503    /// - `n`: the number of possible outcomes. n must be positive.
4504    ///
4505    /// ## Return value
4506    /// Returns a random value in the range of \[0 .. n-1\].
4507    ///
4508    /// ## Thread safety
4509    /// All calls should be made from a single thread
4510    ///
4511    /// ## Availability
4512    /// This function is available since SDL 3.2.0.
4513    ///
4514    /// ## See also
4515    /// - [`SDL_srand`]
4516    /// - [`SDL_randf`]
4517    pub fn SDL_rand(n: Sint32) -> Sint32;
4518}
4519
4520unsafe extern "C" {
4521    /// Generate a uniform pseudo-random floating point number less than 1.0
4522    ///
4523    /// If you want reproducible output, be sure to initialize with [`SDL_srand()`]
4524    /// first.
4525    ///
4526    /// There are no guarantees as to the quality of the random sequence produced,
4527    /// and this should not be used for security (cryptography, passwords) or where
4528    /// money is on the line (loot-boxes, casinos). There are many random number
4529    /// libraries available with different characteristics and you should pick one
4530    /// of those to meet any serious needs.
4531    ///
4532    /// ## Return value
4533    /// Returns a random value in the range of [0.0, 1.0).
4534    ///
4535    /// ## Thread safety
4536    /// All calls should be made from a single thread
4537    ///
4538    /// ## Availability
4539    /// This function is available since SDL 3.2.0.
4540    ///
4541    /// ## See also
4542    /// - [`SDL_srand`]
4543    /// - [`SDL_rand`]
4544    pub fn SDL_randf() -> ::core::ffi::c_float;
4545}
4546
4547unsafe extern "C" {
4548    /// Generate 32 pseudo-random bits.
4549    ///
4550    /// You likely want to use [`SDL_rand()`] to get a psuedo-random number instead.
4551    ///
4552    /// There are no guarantees as to the quality of the random sequence produced,
4553    /// and this should not be used for security (cryptography, passwords) or where
4554    /// money is on the line (loot-boxes, casinos). There are many random number
4555    /// libraries available with different characteristics and you should pick one
4556    /// of those to meet any serious needs.
4557    ///
4558    /// ## Return value
4559    /// Returns a random value in the range of \[0-SDL_MAX_UINT32\].
4560    ///
4561    /// ## Thread safety
4562    /// All calls should be made from a single thread
4563    ///
4564    /// ## Availability
4565    /// This function is available since SDL 3.2.0.
4566    ///
4567    /// ## See also
4568    /// - [`SDL_rand`]
4569    /// - [`SDL_randf`]
4570    /// - [`SDL_srand`]
4571    pub fn SDL_rand_bits() -> Uint32;
4572}
4573
4574unsafe extern "C" {
4575    /// Generate a pseudo-random number less than n for positive n
4576    ///
4577    /// The method used is faster and of better quality than `rand() % n`. Odds are
4578    /// roughly 99.9% even for n = 1 million. Evenness is better for smaller n, and
4579    /// much worse as n gets bigger.
4580    ///
4581    /// Example: to simulate a d6 use `SDL_rand_r(state, 6) + 1` The +1 converts
4582    /// 0..5 to 1..6
4583    ///
4584    /// If you want to generate a pseudo-random number in the full range of Sint32,
4585    /// you should use: (Sint32)SDL_rand_bits_r(state)
4586    ///
4587    /// There are no guarantees as to the quality of the random sequence produced,
4588    /// and this should not be used for security (cryptography, passwords) or where
4589    /// money is on the line (loot-boxes, casinos). There are many random number
4590    /// libraries available with different characteristics and you should pick one
4591    /// of those to meet any serious needs.
4592    ///
4593    /// ## Parameters
4594    /// - `state`: a pointer to the current random number state, this may not be
4595    ///   NULL.
4596    /// - `n`: the number of possible outcomes. n must be positive.
4597    ///
4598    /// ## Return value
4599    /// Returns a random value in the range of \[0 .. n-1\].
4600    ///
4601    /// ## Thread safety
4602    /// This function is thread-safe, as long as the state pointer
4603    ///   isn't shared between threads.
4604    ///
4605    /// ## Availability
4606    /// This function is available since SDL 3.2.0.
4607    ///
4608    /// ## See also
4609    /// - [`SDL_rand`]
4610    /// - [`SDL_rand_bits_r`]
4611    /// - [`SDL_randf_r`]
4612    pub fn SDL_rand_r(state: *mut Uint64, n: Sint32) -> Sint32;
4613}
4614
4615unsafe extern "C" {
4616    /// Generate a uniform pseudo-random floating point number less than 1.0
4617    ///
4618    /// If you want reproducible output, be sure to initialize with [`SDL_srand()`]
4619    /// first.
4620    ///
4621    /// There are no guarantees as to the quality of the random sequence produced,
4622    /// and this should not be used for security (cryptography, passwords) or where
4623    /// money is on the line (loot-boxes, casinos). There are many random number
4624    /// libraries available with different characteristics and you should pick one
4625    /// of those to meet any serious needs.
4626    ///
4627    /// ## Parameters
4628    /// - `state`: a pointer to the current random number state, this may not be
4629    ///   NULL.
4630    ///
4631    /// ## Return value
4632    /// Returns a random value in the range of [0.0, 1.0).
4633    ///
4634    /// ## Thread safety
4635    /// This function is thread-safe, as long as the state pointer
4636    ///   isn't shared between threads.
4637    ///
4638    /// ## Availability
4639    /// This function is available since SDL 3.2.0.
4640    ///
4641    /// ## See also
4642    /// - [`SDL_rand_bits_r`]
4643    /// - [`SDL_rand_r`]
4644    /// - [`SDL_randf`]
4645    pub fn SDL_randf_r(state: *mut Uint64) -> ::core::ffi::c_float;
4646}
4647
4648unsafe extern "C" {
4649    /// Generate 32 pseudo-random bits.
4650    ///
4651    /// You likely want to use [`SDL_rand_r()`] to get a psuedo-random number instead.
4652    ///
4653    /// There are no guarantees as to the quality of the random sequence produced,
4654    /// and this should not be used for security (cryptography, passwords) or where
4655    /// money is on the line (loot-boxes, casinos). There are many random number
4656    /// libraries available with different characteristics and you should pick one
4657    /// of those to meet any serious needs.
4658    ///
4659    /// ## Parameters
4660    /// - `state`: a pointer to the current random number state, this may not be
4661    ///   NULL.
4662    ///
4663    /// ## Return value
4664    /// Returns a random value in the range of \[0-SDL_MAX_UINT32\].
4665    ///
4666    /// ## Thread safety
4667    /// This function is thread-safe, as long as the state pointer
4668    ///   isn't shared between threads.
4669    ///
4670    /// ## Availability
4671    /// This function is available since SDL 3.2.0.
4672    ///
4673    /// ## See also
4674    /// - [`SDL_rand_r`]
4675    /// - [`SDL_randf_r`]
4676    pub fn SDL_rand_bits_r(state: *mut Uint64) -> Uint32;
4677}
4678
4679/// The value of Pi, as a double-precision floating point literal.
4680///
4681/// ## Availability
4682/// This macro is available since SDL 3.2.0.
4683///
4684/// ## See also
4685/// - [`SDL_PI_F`]
4686pub const SDL_PI_D: ::core::ffi::c_double = 3.141592653589793_f64;
4687
4688/// The value of Pi, as a single-precision floating point literal.
4689///
4690/// ## Availability
4691/// This macro is available since SDL 3.2.0.
4692///
4693/// ## See also
4694/// - [`SDL_PI_D`]
4695pub const SDL_PI_F: ::core::ffi::c_float = 3.1415927_f32;
4696
4697unsafe extern "C" {
4698    /// Compute the arc cosine of `x`.
4699    ///
4700    /// The definition of `y = acos(x)` is `x = cos(y)`.
4701    ///
4702    /// Domain: `-1 <= x <= 1`
4703    ///
4704    /// Range: `0 <= y <= Pi`
4705    ///
4706    /// This function operates on double-precision floating point values, use
4707    /// [`SDL_acosf`] for single-precision floats.
4708    ///
4709    /// This function may use a different approximation across different versions,
4710    /// platforms and configurations. i.e, it can return a different value given
4711    /// the same input on different machines or operating systems, or if SDL is
4712    /// updated.
4713    ///
4714    /// ## Parameters
4715    /// - `x`: floating point value.
4716    ///
4717    /// ## Return value
4718    /// Returns arc cosine of `x`, in radians.
4719    ///
4720    /// ## Thread safety
4721    /// It is safe to call this function from any thread.
4722    ///
4723    /// ## Availability
4724    /// This function is available since SDL 3.2.0.
4725    ///
4726    /// ## See also
4727    /// - [`SDL_acosf`]
4728    /// - [`SDL_asin`]
4729    /// - [`SDL_cos`]
4730    pub safe fn SDL_acos(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
4731}
4732
4733unsafe extern "C" {
4734    /// Compute the arc cosine of `x`.
4735    ///
4736    /// The definition of `y = acos(x)` is `x = cos(y)`.
4737    ///
4738    /// Domain: `-1 <= x <= 1`
4739    ///
4740    /// Range: `0 <= y <= Pi`
4741    ///
4742    /// This function operates on single-precision floating point values, use
4743    /// [`SDL_acos`] for double-precision floats.
4744    ///
4745    /// This function may use a different approximation across different versions,
4746    /// platforms and configurations. i.e, it can return a different value given
4747    /// the same input on different machines or operating systems, or if SDL is
4748    /// updated.
4749    ///
4750    /// ## Parameters
4751    /// - `x`: floating point value.
4752    ///
4753    /// ## Return value
4754    /// Returns arc cosine of `x`, in radians.
4755    ///
4756    /// ## Thread safety
4757    /// It is safe to call this function from any thread.
4758    ///
4759    /// ## Availability
4760    /// This function is available since SDL 3.2.0.
4761    ///
4762    /// ## See also
4763    /// - [`SDL_acos`]
4764    /// - [`SDL_asinf`]
4765    /// - [`SDL_cosf`]
4766    pub safe fn SDL_acosf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
4767}
4768
4769unsafe extern "C" {
4770    /// Compute the arc sine of `x`.
4771    ///
4772    /// The definition of `y = asin(x)` is `x = sin(y)`.
4773    ///
4774    /// Domain: `-1 <= x <= 1`
4775    ///
4776    /// Range: `-Pi/2 <= y <= Pi/2`
4777    ///
4778    /// This function operates on double-precision floating point values, use
4779    /// [`SDL_asinf`] for single-precision floats.
4780    ///
4781    /// This function may use a different approximation across different versions,
4782    /// platforms and configurations. i.e, it can return a different value given
4783    /// the same input on different machines or operating systems, or if SDL is
4784    /// updated.
4785    ///
4786    /// ## Parameters
4787    /// - `x`: floating point value.
4788    ///
4789    /// ## Return value
4790    /// Returns arc sine of `x`, in radians.
4791    ///
4792    /// ## Thread safety
4793    /// It is safe to call this function from any thread.
4794    ///
4795    /// ## Availability
4796    /// This function is available since SDL 3.2.0.
4797    ///
4798    /// ## See also
4799    /// - [`SDL_asinf`]
4800    /// - [`SDL_acos`]
4801    /// - [`SDL_sin`]
4802    pub safe fn SDL_asin(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
4803}
4804
4805unsafe extern "C" {
4806    /// Compute the arc sine of `x`.
4807    ///
4808    /// The definition of `y = asin(x)` is `x = sin(y)`.
4809    ///
4810    /// Domain: `-1 <= x <= 1`
4811    ///
4812    /// Range: `-Pi/2 <= y <= Pi/2`
4813    ///
4814    /// This function operates on single-precision floating point values, use
4815    /// [`SDL_asin`] for double-precision floats.
4816    ///
4817    /// This function may use a different approximation across different versions,
4818    /// platforms and configurations. i.e, it can return a different value given
4819    /// the same input on different machines or operating systems, or if SDL is
4820    /// updated.
4821    ///
4822    /// ## Parameters
4823    /// - `x`: floating point value.
4824    ///
4825    /// ## Return value
4826    /// Returns arc sine of `x`, in radians.
4827    ///
4828    /// ## Thread safety
4829    /// It is safe to call this function from any thread.
4830    ///
4831    /// ## Availability
4832    /// This function is available since SDL 3.2.0.
4833    ///
4834    /// ## See also
4835    /// - [`SDL_asin`]
4836    /// - [`SDL_acosf`]
4837    /// - [`SDL_sinf`]
4838    pub safe fn SDL_asinf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
4839}
4840
4841unsafe extern "C" {
4842    /// Compute the arc tangent of `x`.
4843    ///
4844    /// The definition of `y = atan(x)` is `x = tan(y)`.
4845    ///
4846    /// Domain: `-INF <= x <= INF`
4847    ///
4848    /// Range: `-Pi/2 <= y <= Pi/2`
4849    ///
4850    /// This function operates on double-precision floating point values, use
4851    /// [`SDL_atanf`] for single-precision floats.
4852    ///
4853    /// To calculate the arc tangent of y / x, use [`SDL_atan2`].
4854    ///
4855    /// This function may use a different approximation across different versions,
4856    /// platforms and configurations. i.e, it can return a different value given
4857    /// the same input on different machines or operating systems, or if SDL is
4858    /// updated.
4859    ///
4860    /// ## Parameters
4861    /// - `x`: floating point value.
4862    ///
4863    /// ## Return value
4864    /// Returns arc tangent of of `x` in radians, or 0 if `x = 0`.
4865    ///
4866    /// ## Thread safety
4867    /// It is safe to call this function from any thread.
4868    ///
4869    /// ## Availability
4870    /// This function is available since SDL 3.2.0.
4871    ///
4872    /// ## See also
4873    /// - [`SDL_atanf`]
4874    /// - [`SDL_atan2`]
4875    /// - [`SDL_tan`]
4876    pub safe fn SDL_atan(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
4877}
4878
4879unsafe extern "C" {
4880    /// Compute the arc tangent of `x`.
4881    ///
4882    /// The definition of `y = atan(x)` is `x = tan(y)`.
4883    ///
4884    /// Domain: `-INF <= x <= INF`
4885    ///
4886    /// Range: `-Pi/2 <= y <= Pi/2`
4887    ///
4888    /// This function operates on single-precision floating point values, use
4889    /// [`SDL_atan`] for dboule-precision floats.
4890    ///
4891    /// To calculate the arc tangent of y / x, use [`SDL_atan2f`].
4892    ///
4893    /// This function may use a different approximation across different versions,
4894    /// platforms and configurations. i.e, it can return a different value given
4895    /// the same input on different machines or operating systems, or if SDL is
4896    /// updated.
4897    ///
4898    /// ## Parameters
4899    /// - `x`: floating point value.
4900    ///
4901    /// ## Return value
4902    /// Returns arc tangent of of `x` in radians, or 0 if `x = 0`.
4903    ///
4904    /// ## Thread safety
4905    /// It is safe to call this function from any thread.
4906    ///
4907    /// ## Availability
4908    /// This function is available since SDL 3.2.0.
4909    ///
4910    /// ## See also
4911    /// - [`SDL_atan`]
4912    /// - [`SDL_atan2f`]
4913    /// - [`SDL_tanf`]
4914    pub safe fn SDL_atanf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
4915}
4916
4917unsafe extern "C" {
4918    /// Compute the arc tangent of `y / x`, using the signs of x and y to adjust
4919    /// the result's quadrant.
4920    ///
4921    /// The definition of `z = atan2(x, y)` is `y = x tan(z)`, where the quadrant
4922    /// of z is determined based on the signs of x and y.
4923    ///
4924    /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF`
4925    ///
4926    /// Range: `-Pi <= y <= Pi`
4927    ///
4928    /// This function operates on double-precision floating point values, use
4929    /// [`SDL_atan2f`] for single-precision floats.
4930    ///
4931    /// To calculate the arc tangent of a single value, use [`SDL_atan`].
4932    ///
4933    /// This function may use a different approximation across different versions,
4934    /// platforms and configurations. i.e, it can return a different value given
4935    /// the same input on different machines or operating systems, or if SDL is
4936    /// updated.
4937    ///
4938    /// ## Parameters
4939    /// - `y`: floating point value of the numerator (y coordinate).
4940    /// - `x`: floating point value of the denominator (x coordinate).
4941    ///
4942    /// ## Return value
4943    /// Returns arc tangent of of `y / x` in radians, or, if `x = 0`, either
4944    ///   `-Pi/2`, `0`, or `Pi/2`, depending on the value of `y`.
4945    ///
4946    /// ## Thread safety
4947    /// It is safe to call this function from any thread.
4948    ///
4949    /// ## Availability
4950    /// This function is available since SDL 3.2.0.
4951    ///
4952    /// ## See also
4953    /// - [`SDL_atan2f`]
4954    /// - [`SDL_atan`]
4955    /// - [`SDL_tan`]
4956    pub safe fn SDL_atan2(
4957        y: ::core::ffi::c_double,
4958        x: ::core::ffi::c_double,
4959    ) -> ::core::ffi::c_double;
4960}
4961
4962unsafe extern "C" {
4963    /// Compute the arc tangent of `y / x`, using the signs of x and y to adjust
4964    /// the result's quadrant.
4965    ///
4966    /// The definition of `z = atan2(x, y)` is `y = x tan(z)`, where the quadrant
4967    /// of z is determined based on the signs of x and y.
4968    ///
4969    /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF`
4970    ///
4971    /// Range: `-Pi <= y <= Pi`
4972    ///
4973    /// This function operates on single-precision floating point values, use
4974    /// [`SDL_atan2`] for double-precision floats.
4975    ///
4976    /// To calculate the arc tangent of a single value, use [`SDL_atanf`].
4977    ///
4978    /// This function may use a different approximation across different versions,
4979    /// platforms and configurations. i.e, it can return a different value given
4980    /// the same input on different machines or operating systems, or if SDL is
4981    /// updated.
4982    ///
4983    /// ## Parameters
4984    /// - `y`: floating point value of the numerator (y coordinate).
4985    /// - `x`: floating point value of the denominator (x coordinate).
4986    ///
4987    /// ## Return value
4988    /// Returns arc tangent of of `y / x` in radians, or, if `x = 0`, either
4989    ///   `-Pi/2`, `0`, or `Pi/2`, depending on the value of `y`.
4990    ///
4991    /// ## Thread safety
4992    /// It is safe to call this function from any thread.
4993    ///
4994    /// ## Availability
4995    /// This function is available since SDL 3.2.0.
4996    ///
4997    /// ## See also
4998    /// - [`SDL_atan2`]
4999    /// - [`SDL_atan`]
5000    /// - [`SDL_tan`]
5001    pub safe fn SDL_atan2f(
5002        y: ::core::ffi::c_float,
5003        x: ::core::ffi::c_float,
5004    ) -> ::core::ffi::c_float;
5005}
5006
5007unsafe extern "C" {
5008    /// Compute the ceiling of `x`.
5009    ///
5010    /// The ceiling of `x` is the smallest integer `y` such that `y >= x`, i.e `x`
5011    /// rounded up to the nearest integer.
5012    ///
5013    /// Domain: `-INF <= x <= INF`
5014    ///
5015    /// Range: `-INF <= y <= INF`, y integer
5016    ///
5017    /// This function operates on double-precision floating point values, use
5018    /// [`SDL_ceilf`] for single-precision floats.
5019    ///
5020    /// ## Parameters
5021    /// - `x`: floating point value.
5022    ///
5023    /// ## Return value
5024    /// Returns the ceiling of `x`.
5025    ///
5026    /// ## Thread safety
5027    /// It is safe to call this function from any thread.
5028    ///
5029    /// ## Availability
5030    /// This function is available since SDL 3.2.0.
5031    ///
5032    /// ## See also
5033    /// - [`SDL_ceilf`]
5034    /// - [`SDL_floor`]
5035    /// - [`SDL_trunc`]
5036    /// - [`SDL_round`]
5037    /// - [`SDL_lround`]
5038    pub safe fn SDL_ceil(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
5039}
5040
5041unsafe extern "C" {
5042    /// Compute the ceiling of `x`.
5043    ///
5044    /// The ceiling of `x` is the smallest integer `y` such that `y >= x`, i.e `x`
5045    /// rounded up to the nearest integer.
5046    ///
5047    /// Domain: `-INF <= x <= INF`
5048    ///
5049    /// Range: `-INF <= y <= INF`, y integer
5050    ///
5051    /// This function operates on single-precision floating point values, use
5052    /// [`SDL_ceil`] for double-precision floats.
5053    ///
5054    /// ## Parameters
5055    /// - `x`: floating point value.
5056    ///
5057    /// ## Return value
5058    /// Returns the ceiling of `x`.
5059    ///
5060    /// ## Thread safety
5061    /// It is safe to call this function from any thread.
5062    ///
5063    /// ## Availability
5064    /// This function is available since SDL 3.2.0.
5065    ///
5066    /// ## See also
5067    /// - [`SDL_ceil`]
5068    /// - [`SDL_floorf`]
5069    /// - [`SDL_truncf`]
5070    /// - [`SDL_roundf`]
5071    /// - [`SDL_lroundf`]
5072    pub safe fn SDL_ceilf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
5073}
5074
5075/// Copy the sign of one floating-point value to another.
5076///
5077/// The definition of copysign is that ``copysign(x, y) = abs(x) * sign(y)``.
5078///
5079/// Domain: `-INF <= x <= INF`, ``-INF <= y <= f``
5080///
5081/// Range: `-INF <= z <= INF`
5082///
5083/// This function operates on double-precision floating point values, use
5084/// [`SDL_copysignf`] for single-precision floats.
5085///
5086/// ## Parameters
5087/// - `x`: floating point value to use as the magnitude.
5088/// - `y`: floating point value to use as the sign.
5089///
5090/// ## Return value
5091/// Returns the floating point value with the sign of y and the magnitude of
5092///   x.
5093///
5094/// ## Thread safety
5095/// It is safe to call this function from any thread.
5096///
5097/// ## Availability
5098/// This function is available since SDL 3.2.0.
5099///
5100/// ## See also
5101/// - [`SDL_copysignf`]
5102/// - [`SDL_fabs`]
5103#[inline(always)]
5104pub const fn SDL_copysign(
5105    x: ::core::ffi::c_double,
5106    y: ::core::ffi::c_double,
5107) -> ::core::ffi::c_double {
5108    return x.copysign(y);
5109}
5110
5111/// Copy the sign of one floating-point value to another.
5112///
5113/// The definition of copysign is that ``copysign(x, y) = abs(x) * sign(y)``.
5114///
5115/// Domain: `-INF <= x <= INF`, ``-INF <= y <= f``
5116///
5117/// Range: `-INF <= z <= INF`
5118///
5119/// This function operates on single-precision floating point values, use
5120/// [`SDL_copysign`] for double-precision floats.
5121///
5122/// ## Parameters
5123/// - `x`: floating point value to use as the magnitude.
5124/// - `y`: floating point value to use as the sign.
5125///
5126/// ## Return value
5127/// Returns the floating point value with the sign of y and the magnitude of
5128///   x.
5129///
5130/// ## Thread safety
5131/// It is safe to call this function from any thread.
5132///
5133/// ## Availability
5134/// This function is available since SDL 3.2.0.
5135///
5136/// ## See also
5137/// - [`SDL_copysign`]
5138/// - [`SDL_fabsf`]
5139#[inline(always)]
5140pub const fn SDL_copysignf(
5141    x: ::core::ffi::c_float,
5142    y: ::core::ffi::c_float,
5143) -> ::core::ffi::c_float {
5144    return x.copysign(y);
5145}
5146
5147unsafe extern "C" {
5148    /// Compute the cosine of `x`.
5149    ///
5150    /// Domain: `-INF <= x <= INF`
5151    ///
5152    /// Range: `-1 <= y <= 1`
5153    ///
5154    /// This function operates on double-precision floating point values, use
5155    /// [`SDL_cosf`] for single-precision floats.
5156    ///
5157    /// This function may use a different approximation across different versions,
5158    /// platforms and configurations. i.e, it can return a different value given
5159    /// the same input on different machines or operating systems, or if SDL is
5160    /// updated.
5161    ///
5162    /// ## Parameters
5163    /// - `x`: floating point value, in radians.
5164    ///
5165    /// ## Return value
5166    /// Returns cosine of `x`.
5167    ///
5168    /// ## Thread safety
5169    /// It is safe to call this function from any thread.
5170    ///
5171    /// ## Availability
5172    /// This function is available since SDL 3.2.0.
5173    ///
5174    /// ## See also
5175    /// - [`SDL_cosf`]
5176    /// - [`SDL_acos`]
5177    /// - [`SDL_sin`]
5178    pub safe fn SDL_cos(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
5179}
5180
5181unsafe extern "C" {
5182    /// Compute the cosine of `x`.
5183    ///
5184    /// Domain: `-INF <= x <= INF`
5185    ///
5186    /// Range: `-1 <= y <= 1`
5187    ///
5188    /// This function operates on single-precision floating point values, use
5189    /// [`SDL_cos`] for double-precision floats.
5190    ///
5191    /// This function may use a different approximation across different versions,
5192    /// platforms and configurations. i.e, it can return a different value given
5193    /// the same input on different machines or operating systems, or if SDL is
5194    /// updated.
5195    ///
5196    /// ## Parameters
5197    /// - `x`: floating point value, in radians.
5198    ///
5199    /// ## Return value
5200    /// Returns cosine of `x`.
5201    ///
5202    /// ## Thread safety
5203    /// It is safe to call this function from any thread.
5204    ///
5205    /// ## Availability
5206    /// This function is available since SDL 3.2.0.
5207    ///
5208    /// ## See also
5209    /// - [`SDL_cos`]
5210    /// - [`SDL_acosf`]
5211    /// - [`SDL_sinf`]
5212    pub safe fn SDL_cosf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
5213}
5214
5215unsafe extern "C" {
5216    /// Compute the exponential of `x`.
5217    ///
5218    /// The definition of `y = exp(x)` is `y = e^x`, where `e` is the base of the
5219    /// natural logarithm. The inverse is the natural logarithm, [`SDL_log`].
5220    ///
5221    /// Domain: `-INF <= x <= INF`
5222    ///
5223    /// Range: `0 <= y <= INF`
5224    ///
5225    /// The output will overflow if `exp(x)` is too large to be represented.
5226    ///
5227    /// This function operates on double-precision floating point values, use
5228    /// [`SDL_expf`] for single-precision floats.
5229    ///
5230    /// This function may use a different approximation across different versions,
5231    /// platforms and configurations. i.e, it can return a different value given
5232    /// the same input on different machines or operating systems, or if SDL is
5233    /// updated.
5234    ///
5235    /// ## Parameters
5236    /// - `x`: floating point value.
5237    ///
5238    /// ## Return value
5239    /// Returns value of `e^x`.
5240    ///
5241    /// ## Thread safety
5242    /// It is safe to call this function from any thread.
5243    ///
5244    /// ## Availability
5245    /// This function is available since SDL 3.2.0.
5246    ///
5247    /// ## See also
5248    /// - [`SDL_expf`]
5249    /// - [`SDL_log`]
5250    pub safe fn SDL_exp(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
5251}
5252
5253unsafe extern "C" {
5254    /// Compute the exponential of `x`.
5255    ///
5256    /// The definition of `y = exp(x)` is `y = e^x`, where `e` is the base of the
5257    /// natural logarithm. The inverse is the natural logarithm, [`SDL_logf`].
5258    ///
5259    /// Domain: `-INF <= x <= INF`
5260    ///
5261    /// Range: `0 <= y <= INF`
5262    ///
5263    /// The output will overflow if `exp(x)` is too large to be represented.
5264    ///
5265    /// This function operates on single-precision floating point values, use
5266    /// [`SDL_exp`] for double-precision floats.
5267    ///
5268    /// This function may use a different approximation across different versions,
5269    /// platforms and configurations. i.e, it can return a different value given
5270    /// the same input on different machines or operating systems, or if SDL is
5271    /// updated.
5272    ///
5273    /// ## Parameters
5274    /// - `x`: floating point value.
5275    ///
5276    /// ## Return value
5277    /// Returns value of `e^x`.
5278    ///
5279    /// ## Thread safety
5280    /// It is safe to call this function from any thread.
5281    ///
5282    /// ## Availability
5283    /// This function is available since SDL 3.2.0.
5284    ///
5285    /// ## See also
5286    /// - [`SDL_exp`]
5287    /// - [`SDL_logf`]
5288    pub safe fn SDL_expf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
5289}
5290
5291/// Compute the absolute value of `x`
5292///
5293/// Domain: `-INF <= x <= INF`
5294///
5295/// Range: `0 <= y <= INF`
5296///
5297/// This function operates on double-precision floating point values, use
5298/// [`SDL_fabsf`] for single-precision floats.
5299///
5300/// ## Parameters
5301/// - `x`: floating point value to use as the magnitude.
5302///
5303/// ## Return value
5304/// Returns the absolute value of `x`.
5305///
5306/// ## Thread safety
5307/// It is safe to call this function from any thread.
5308///
5309/// ## Availability
5310/// This function is available since SDL 3.2.0.
5311///
5312/// ## See also
5313/// - [`SDL_fabsf`]
5314#[inline(always)]
5315pub const fn SDL_fabs(x: ::core::ffi::c_double) -> ::core::ffi::c_double {
5316    return x.abs();
5317}
5318
5319/// Compute the absolute value of `x`
5320///
5321/// Domain: `-INF <= x <= INF`
5322///
5323/// Range: `0 <= y <= INF`
5324///
5325/// This function operates on single-precision floating point values, use
5326/// [`SDL_fabs`] for double-precision floats.
5327///
5328/// ## Parameters
5329/// - `x`: floating point value to use as the magnitude.
5330///
5331/// ## Return value
5332/// Returns the absolute value of `x`.
5333///
5334/// ## Thread safety
5335/// It is safe to call this function from any thread.
5336///
5337/// ## Availability
5338/// This function is available since SDL 3.2.0.
5339///
5340/// ## See also
5341/// - [`SDL_fabs`]
5342#[inline(always)]
5343pub const fn SDL_fabsf(x: ::core::ffi::c_float) -> ::core::ffi::c_float {
5344    return x.abs();
5345}
5346
5347unsafe extern "C" {
5348    /// Compute the floor of `x`.
5349    ///
5350    /// The floor of `x` is the largest integer `y` such that `y <= x`, i.e `x`
5351    /// rounded down to the nearest integer.
5352    ///
5353    /// Domain: `-INF <= x <= INF`
5354    ///
5355    /// Range: `-INF <= y <= INF`, y integer
5356    ///
5357    /// This function operates on double-precision floating point values, use
5358    /// [`SDL_floorf`] for single-precision floats.
5359    ///
5360    /// ## Parameters
5361    /// - `x`: floating point value.
5362    ///
5363    /// ## Return value
5364    /// Returns the floor of `x`.
5365    ///
5366    /// ## Thread safety
5367    /// It is safe to call this function from any thread.
5368    ///
5369    /// ## Availability
5370    /// This function is available since SDL 3.2.0.
5371    ///
5372    /// ## See also
5373    /// - [`SDL_floorf`]
5374    /// - [`SDL_ceil`]
5375    /// - [`SDL_trunc`]
5376    /// - [`SDL_round`]
5377    /// - [`SDL_lround`]
5378    pub safe fn SDL_floor(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
5379}
5380
5381unsafe extern "C" {
5382    /// Compute the floor of `x`.
5383    ///
5384    /// The floor of `x` is the largest integer `y` such that `y <= x`, i.e `x`
5385    /// rounded down to the nearest integer.
5386    ///
5387    /// Domain: `-INF <= x <= INF`
5388    ///
5389    /// Range: `-INF <= y <= INF`, y integer
5390    ///
5391    /// This function operates on single-precision floating point values, use
5392    /// [`SDL_floor`] for double-precision floats.
5393    ///
5394    /// ## Parameters
5395    /// - `x`: floating point value.
5396    ///
5397    /// ## Return value
5398    /// Returns the floor of `x`.
5399    ///
5400    /// ## Thread safety
5401    /// It is safe to call this function from any thread.
5402    ///
5403    /// ## Availability
5404    /// This function is available since SDL 3.2.0.
5405    ///
5406    /// ## See also
5407    /// - [`SDL_floor`]
5408    /// - [`SDL_ceilf`]
5409    /// - [`SDL_truncf`]
5410    /// - [`SDL_roundf`]
5411    /// - [`SDL_lroundf`]
5412    pub safe fn SDL_floorf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
5413}
5414
5415unsafe extern "C" {
5416    /// Truncate `x` to an integer.
5417    ///
5418    /// Rounds `x` to the next closest integer to 0. This is equivalent to removing
5419    /// the fractional part of `x`, leaving only the integer part.
5420    ///
5421    /// Domain: `-INF <= x <= INF`
5422    ///
5423    /// Range: `-INF <= y <= INF`, y integer
5424    ///
5425    /// This function operates on double-precision floating point values, use
5426    /// [`SDL_truncf`] for single-precision floats.
5427    ///
5428    /// ## Parameters
5429    /// - `x`: floating point value.
5430    ///
5431    /// ## Return value
5432    /// Returns `x` truncated to an integer.
5433    ///
5434    /// ## Thread safety
5435    /// It is safe to call this function from any thread.
5436    ///
5437    /// ## Availability
5438    /// This function is available since SDL 3.2.0.
5439    ///
5440    /// ## See also
5441    /// - [`SDL_truncf`]
5442    /// - [`SDL_fmod`]
5443    /// - [`SDL_ceil`]
5444    /// - [`SDL_floor`]
5445    /// - [`SDL_round`]
5446    /// - [`SDL_lround`]
5447    pub safe fn SDL_trunc(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
5448}
5449
5450unsafe extern "C" {
5451    /// Truncate `x` to an integer.
5452    ///
5453    /// Rounds `x` to the next closest integer to 0. This is equivalent to removing
5454    /// the fractional part of `x`, leaving only the integer part.
5455    ///
5456    /// Domain: `-INF <= x <= INF`
5457    ///
5458    /// Range: `-INF <= y <= INF`, y integer
5459    ///
5460    /// This function operates on single-precision floating point values, use
5461    /// [`SDL_trunc`] for double-precision floats.
5462    ///
5463    /// ## Parameters
5464    /// - `x`: floating point value.
5465    ///
5466    /// ## Return value
5467    /// Returns `x` truncated to an integer.
5468    ///
5469    /// ## Thread safety
5470    /// It is safe to call this function from any thread.
5471    ///
5472    /// ## Availability
5473    /// This function is available since SDL 3.2.0.
5474    ///
5475    /// ## See also
5476    /// - [`SDL_trunc`]
5477    /// - [`SDL_fmodf`]
5478    /// - [`SDL_ceilf`]
5479    /// - [`SDL_floorf`]
5480    /// - [`SDL_roundf`]
5481    /// - [`SDL_lroundf`]
5482    pub safe fn SDL_truncf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
5483}
5484
5485unsafe extern "C" {
5486    /// Return the floating-point remainder of `x / y`
5487    ///
5488    /// Divides `x` by `y`, and returns the remainder.
5489    ///
5490    /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF`, `y != 0`
5491    ///
5492    /// Range: `-y <= z <= y`
5493    ///
5494    /// This function operates on double-precision floating point values, use
5495    /// [`SDL_fmodf`] for single-precision floats.
5496    ///
5497    /// ## Parameters
5498    /// - `x`: the numerator.
5499    /// - `y`: the denominator. Must not be 0.
5500    ///
5501    /// ## Return value
5502    /// Returns the remainder of `x / y`.
5503    ///
5504    /// ## Thread safety
5505    /// It is safe to call this function from any thread.
5506    ///
5507    /// ## Availability
5508    /// This function is available since SDL 3.2.0.
5509    ///
5510    /// ## See also
5511    /// - [`SDL_fmodf`]
5512    /// - [`SDL_modf`]
5513    /// - [`SDL_trunc`]
5514    /// - [`SDL_ceil`]
5515    /// - [`SDL_floor`]
5516    /// - [`SDL_round`]
5517    /// - [`SDL_lround`]
5518    pub safe fn SDL_fmod(
5519        x: ::core::ffi::c_double,
5520        y: ::core::ffi::c_double,
5521    ) -> ::core::ffi::c_double;
5522}
5523
5524unsafe extern "C" {
5525    /// Return the floating-point remainder of `x / y`
5526    ///
5527    /// Divides `x` by `y`, and returns the remainder.
5528    ///
5529    /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF`, `y != 0`
5530    ///
5531    /// Range: `-y <= z <= y`
5532    ///
5533    /// This function operates on single-precision floating point values, use
5534    /// [`SDL_fmod`] for double-precision floats.
5535    ///
5536    /// ## Parameters
5537    /// - `x`: the numerator.
5538    /// - `y`: the denominator. Must not be 0.
5539    ///
5540    /// ## Return value
5541    /// Returns the remainder of `x / y`.
5542    ///
5543    /// ## Thread safety
5544    /// It is safe to call this function from any thread.
5545    ///
5546    /// ## Availability
5547    /// This function is available since SDL 3.2.0.
5548    ///
5549    /// ## See also
5550    /// - [`SDL_fmod`]
5551    /// - [`SDL_truncf`]
5552    /// - [`SDL_modff`]
5553    /// - [`SDL_ceilf`]
5554    /// - [`SDL_floorf`]
5555    /// - [`SDL_roundf`]
5556    /// - [`SDL_lroundf`]
5557    pub safe fn SDL_fmodf(x: ::core::ffi::c_float, y: ::core::ffi::c_float)
5558    -> ::core::ffi::c_float;
5559}
5560
5561/// Return whether the value is infinity.
5562///
5563/// ## Parameters
5564/// - `x`: double-precision floating point value.
5565///
5566/// ## Return value
5567/// Returns non-zero if the value is infinity, 0 otherwise.
5568///
5569/// ## Thread safety
5570/// It is safe to call this function from any thread.
5571///
5572/// ## Availability
5573/// This function is available since SDL 3.2.0.
5574///
5575/// ## See also
5576/// - [`SDL_isinff`]
5577#[inline(always)]
5578pub const fn SDL_isinf(x: ::core::ffi::c_double) -> ::core::ffi::c_int {
5579    return x.is_infinite() as _;
5580}
5581
5582/// Return whether the value is infinity.
5583///
5584/// ## Parameters
5585/// - `x`: floating point value.
5586///
5587/// ## Return value
5588/// Returns non-zero if the value is infinity, 0 otherwise.
5589///
5590/// ## Thread safety
5591/// It is safe to call this function from any thread.
5592///
5593/// ## Availability
5594/// This function is available since SDL 3.2.0.
5595///
5596/// ## See also
5597/// - [`SDL_isinf`]
5598#[inline(always)]
5599pub const fn SDL_isinff(x: ::core::ffi::c_float) -> ::core::ffi::c_int {
5600    return x.is_infinite() as _;
5601}
5602
5603/// Return whether the value is NaN.
5604///
5605/// ## Parameters
5606/// - `x`: double-precision floating point value.
5607///
5608/// ## Return value
5609/// Returns non-zero if the value is NaN, 0 otherwise.
5610///
5611/// ## Thread safety
5612/// It is safe to call this function from any thread.
5613///
5614/// ## Availability
5615/// This function is available since SDL 3.2.0.
5616///
5617/// ## See also
5618/// - [`SDL_isnanf`]
5619#[inline(always)]
5620pub const fn SDL_isnan(x: ::core::ffi::c_double) -> ::core::ffi::c_int {
5621    return x.is_nan() as _;
5622}
5623
5624/// Return whether the value is NaN.
5625///
5626/// ## Parameters
5627/// - `x`: floating point value.
5628///
5629/// ## Return value
5630/// Returns non-zero if the value is NaN, 0 otherwise.
5631///
5632/// ## Thread safety
5633/// It is safe to call this function from any thread.
5634///
5635/// ## Availability
5636/// This function is available since SDL 3.2.0.
5637///
5638/// ## See also
5639/// - [`SDL_isnan`]
5640#[inline(always)]
5641pub const fn SDL_isnanf(x: ::core::ffi::c_float) -> ::core::ffi::c_int {
5642    return x.is_nan() as _;
5643}
5644
5645unsafe extern "C" {
5646    /// Compute the natural logarithm of `x`.
5647    ///
5648    /// Domain: `0 < x <= INF`
5649    ///
5650    /// Range: `-INF <= y <= INF`
5651    ///
5652    /// It is an error for `x` to be less than or equal to 0.
5653    ///
5654    /// This function operates on double-precision floating point values, use
5655    /// [`SDL_logf`] for single-precision floats.
5656    ///
5657    /// This function may use a different approximation across different versions,
5658    /// platforms and configurations. i.e, it can return a different value given
5659    /// the same input on different machines or operating systems, or if SDL is
5660    /// updated.
5661    ///
5662    /// ## Parameters
5663    /// - `x`: floating point value. Must be greater than 0.
5664    ///
5665    /// ## Return value
5666    /// Returns the natural logarithm of `x`.
5667    ///
5668    /// ## Thread safety
5669    /// It is safe to call this function from any thread.
5670    ///
5671    /// ## Availability
5672    /// This function is available since SDL 3.2.0.
5673    ///
5674    /// ## See also
5675    /// - [`SDL_logf`]
5676    /// - [`SDL_log10`]
5677    /// - [`SDL_exp`]
5678    pub safe fn SDL_log(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
5679}
5680
5681unsafe extern "C" {
5682    /// Compute the natural logarithm of `x`.
5683    ///
5684    /// Domain: `0 < x <= INF`
5685    ///
5686    /// Range: `-INF <= y <= INF`
5687    ///
5688    /// It is an error for `x` to be less than or equal to 0.
5689    ///
5690    /// This function operates on single-precision floating point values, use
5691    /// [`SDL_log`] for double-precision floats.
5692    ///
5693    /// This function may use a different approximation across different versions,
5694    /// platforms and configurations. i.e, it can return a different value given
5695    /// the same input on different machines or operating systems, or if SDL is
5696    /// updated.
5697    ///
5698    /// ## Parameters
5699    /// - `x`: floating point value. Must be greater than 0.
5700    ///
5701    /// ## Return value
5702    /// Returns the natural logarithm of `x`.
5703    ///
5704    /// ## Thread safety
5705    /// It is safe to call this function from any thread.
5706    ///
5707    /// ## Availability
5708    /// This function is available since SDL 3.2.0.
5709    ///
5710    /// ## See also
5711    /// - [`SDL_log`]
5712    /// - [`SDL_expf`]
5713    pub safe fn SDL_logf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
5714}
5715
5716unsafe extern "C" {
5717    /// Compute the base-10 logarithm of `x`.
5718    ///
5719    /// Domain: `0 < x <= INF`
5720    ///
5721    /// Range: `-INF <= y <= INF`
5722    ///
5723    /// It is an error for `x` to be less than or equal to 0.
5724    ///
5725    /// This function operates on double-precision floating point values, use
5726    /// [`SDL_log10f`] for single-precision floats.
5727    ///
5728    /// This function may use a different approximation across different versions,
5729    /// platforms and configurations. i.e, it can return a different value given
5730    /// the same input on different machines or operating systems, or if SDL is
5731    /// updated.
5732    ///
5733    /// ## Parameters
5734    /// - `x`: floating point value. Must be greater than 0.
5735    ///
5736    /// ## Return value
5737    /// Returns the logarithm of `x`.
5738    ///
5739    /// ## Thread safety
5740    /// It is safe to call this function from any thread.
5741    ///
5742    /// ## Availability
5743    /// This function is available since SDL 3.2.0.
5744    ///
5745    /// ## See also
5746    /// - [`SDL_log10f`]
5747    /// - [`SDL_log`]
5748    /// - [`SDL_pow`]
5749    pub safe fn SDL_log10(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
5750}
5751
5752unsafe extern "C" {
5753    /// Compute the base-10 logarithm of `x`.
5754    ///
5755    /// Domain: `0 < x <= INF`
5756    ///
5757    /// Range: `-INF <= y <= INF`
5758    ///
5759    /// It is an error for `x` to be less than or equal to 0.
5760    ///
5761    /// This function operates on single-precision floating point values, use
5762    /// [`SDL_log10`] for double-precision floats.
5763    ///
5764    /// This function may use a different approximation across different versions,
5765    /// platforms and configurations. i.e, it can return a different value given
5766    /// the same input on different machines or operating systems, or if SDL is
5767    /// updated.
5768    ///
5769    /// ## Parameters
5770    /// - `x`: floating point value. Must be greater than 0.
5771    ///
5772    /// ## Return value
5773    /// Returns the logarithm of `x`.
5774    ///
5775    /// ## Thread safety
5776    /// It is safe to call this function from any thread.
5777    ///
5778    /// ## Availability
5779    /// This function is available since SDL 3.2.0.
5780    ///
5781    /// ## See also
5782    /// - [`SDL_log10`]
5783    /// - [`SDL_logf`]
5784    /// - [`SDL_powf`]
5785    pub safe fn SDL_log10f(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
5786}
5787
5788unsafe extern "C" {
5789    /// Split `x` into integer and fractional parts
5790    ///
5791    /// This function operates on double-precision floating point values, use
5792    /// [`SDL_modff`] for single-precision floats.
5793    ///
5794    /// ## Parameters
5795    /// - `x`: floating point value.
5796    /// - `y`: output pointer to store the integer part of `x`.
5797    ///
5798    /// ## Return value
5799    /// Returns the fractional part of `x`.
5800    ///
5801    /// ## Thread safety
5802    /// It is safe to call this function from any thread.
5803    ///
5804    /// ## Availability
5805    /// This function is available since SDL 3.2.0.
5806    ///
5807    /// ## See also
5808    /// - [`SDL_modff`]
5809    /// - [`SDL_trunc`]
5810    /// - [`SDL_fmod`]
5811    pub fn SDL_modf(
5812        x: ::core::ffi::c_double,
5813        y: *mut ::core::ffi::c_double,
5814    ) -> ::core::ffi::c_double;
5815}
5816
5817unsafe extern "C" {
5818    /// Split `x` into integer and fractional parts
5819    ///
5820    /// This function operates on single-precision floating point values, use
5821    /// [`SDL_modf`] for double-precision floats.
5822    ///
5823    /// ## Parameters
5824    /// - `x`: floating point value.
5825    /// - `y`: output pointer to store the integer part of `x`.
5826    ///
5827    /// ## Return value
5828    /// Returns the fractional part of `x`.
5829    ///
5830    /// ## Thread safety
5831    /// It is safe to call this function from any thread.
5832    ///
5833    /// ## Availability
5834    /// This function is available since SDL 3.2.0.
5835    ///
5836    /// ## See also
5837    /// - [`SDL_modf`]
5838    /// - [`SDL_truncf`]
5839    /// - [`SDL_fmodf`]
5840    pub fn SDL_modff(x: ::core::ffi::c_float, y: *mut ::core::ffi::c_float)
5841    -> ::core::ffi::c_float;
5842}
5843
5844unsafe extern "C" {
5845    /// Raise `x` to the power `y`
5846    ///
5847    /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF`
5848    ///
5849    /// Range: `-INF <= z <= INF`
5850    ///
5851    /// If `y` is the base of the natural logarithm (e), consider using [`SDL_exp`]
5852    /// instead.
5853    ///
5854    /// This function operates on double-precision floating point values, use
5855    /// [`SDL_powf`] for single-precision floats.
5856    ///
5857    /// This function may use a different approximation across different versions,
5858    /// platforms and configurations. i.e, it can return a different value given
5859    /// the same input on different machines or operating systems, or if SDL is
5860    /// updated.
5861    ///
5862    /// ## Parameters
5863    /// - `x`: the base.
5864    /// - `y`: the exponent.
5865    ///
5866    /// ## Return value
5867    /// Returns `x` raised to the power `y`.
5868    ///
5869    /// ## Thread safety
5870    /// It is safe to call this function from any thread.
5871    ///
5872    /// ## Availability
5873    /// This function is available since SDL 3.2.0.
5874    ///
5875    /// ## See also
5876    /// - [`SDL_powf`]
5877    /// - [`SDL_exp`]
5878    /// - [`SDL_log`]
5879    pub safe fn SDL_pow(
5880        x: ::core::ffi::c_double,
5881        y: ::core::ffi::c_double,
5882    ) -> ::core::ffi::c_double;
5883}
5884
5885unsafe extern "C" {
5886    /// Raise `x` to the power `y`
5887    ///
5888    /// Domain: `-INF <= x <= INF`, `-INF <= y <= INF`
5889    ///
5890    /// Range: `-INF <= z <= INF`
5891    ///
5892    /// If `y` is the base of the natural logarithm (e), consider using [`SDL_exp`]
5893    /// instead.
5894    ///
5895    /// This function operates on single-precision floating point values, use
5896    /// [`SDL_pow`] for double-precision floats.
5897    ///
5898    /// This function may use a different approximation across different versions,
5899    /// platforms and configurations. i.e, it can return a different value given
5900    /// the same input on different machines or operating systems, or if SDL is
5901    /// updated.
5902    ///
5903    /// ## Parameters
5904    /// - `x`: the base.
5905    /// - `y`: the exponent.
5906    ///
5907    /// ## Return value
5908    /// Returns `x` raised to the power `y`.
5909    ///
5910    /// ## Thread safety
5911    /// It is safe to call this function from any thread.
5912    ///
5913    /// ## Availability
5914    /// This function is available since SDL 3.2.0.
5915    ///
5916    /// ## See also
5917    /// - [`SDL_pow`]
5918    /// - [`SDL_expf`]
5919    /// - [`SDL_logf`]
5920    pub safe fn SDL_powf(x: ::core::ffi::c_float, y: ::core::ffi::c_float) -> ::core::ffi::c_float;
5921}
5922
5923unsafe extern "C" {
5924    /// Round `x` to the nearest integer.
5925    ///
5926    /// Rounds `x` to the nearest integer. Values halfway between integers will be
5927    /// rounded away from zero.
5928    ///
5929    /// Domain: `-INF <= x <= INF`
5930    ///
5931    /// Range: `-INF <= y <= INF`, y integer
5932    ///
5933    /// This function operates on double-precision floating point values, use
5934    /// [`SDL_roundf`] for single-precision floats. To get the result as an integer
5935    /// type, use [`SDL_lround`].
5936    ///
5937    /// ## Parameters
5938    /// - `x`: floating point value.
5939    ///
5940    /// ## Return value
5941    /// Returns the nearest integer to `x`.
5942    ///
5943    /// ## Thread safety
5944    /// It is safe to call this function from any thread.
5945    ///
5946    /// ## Availability
5947    /// This function is available since SDL 3.2.0.
5948    ///
5949    /// ## See also
5950    /// - [`SDL_roundf`]
5951    /// - [`SDL_lround`]
5952    /// - [`SDL_floor`]
5953    /// - [`SDL_ceil`]
5954    /// - [`SDL_trunc`]
5955    pub safe fn SDL_round(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
5956}
5957
5958unsafe extern "C" {
5959    /// Round `x` to the nearest integer.
5960    ///
5961    /// Rounds `x` to the nearest integer. Values halfway between integers will be
5962    /// rounded away from zero.
5963    ///
5964    /// Domain: `-INF <= x <= INF`
5965    ///
5966    /// Range: `-INF <= y <= INF`, y integer
5967    ///
5968    /// This function operates on single-precision floating point values, use
5969    /// [`SDL_round`] for double-precision floats. To get the result as an integer
5970    /// type, use [`SDL_lroundf`].
5971    ///
5972    /// ## Parameters
5973    /// - `x`: floating point value.
5974    ///
5975    /// ## Return value
5976    /// Returns the nearest integer to `x`.
5977    ///
5978    /// ## Thread safety
5979    /// It is safe to call this function from any thread.
5980    ///
5981    /// ## Availability
5982    /// This function is available since SDL 3.2.0.
5983    ///
5984    /// ## See also
5985    /// - [`SDL_round`]
5986    /// - [`SDL_lroundf`]
5987    /// - [`SDL_floorf`]
5988    /// - [`SDL_ceilf`]
5989    /// - [`SDL_truncf`]
5990    pub safe fn SDL_roundf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
5991}
5992
5993unsafe extern "C" {
5994    /// Round `x` to the nearest integer representable as a long
5995    ///
5996    /// Rounds `x` to the nearest integer. Values halfway between integers will be
5997    /// rounded away from zero.
5998    ///
5999    /// Domain: `-INF <= x <= INF`
6000    ///
6001    /// Range: `MIN_LONG <= y <= MAX_LONG`
6002    ///
6003    /// This function operates on double-precision floating point values, use
6004    /// [`SDL_lroundf`] for single-precision floats. To get the result as a
6005    /// floating-point type, use [`SDL_round`].
6006    ///
6007    /// ## Parameters
6008    /// - `x`: floating point value.
6009    ///
6010    /// ## Return value
6011    /// Returns the nearest integer to `x`.
6012    ///
6013    /// ## Thread safety
6014    /// It is safe to call this function from any thread.
6015    ///
6016    /// ## Availability
6017    /// This function is available since SDL 3.2.0.
6018    ///
6019    /// ## See also
6020    /// - [`SDL_lroundf`]
6021    /// - [`SDL_round`]
6022    /// - [`SDL_floor`]
6023    /// - [`SDL_ceil`]
6024    /// - [`SDL_trunc`]
6025    pub safe fn SDL_lround(x: ::core::ffi::c_double) -> ::core::ffi::c_long;
6026}
6027
6028unsafe extern "C" {
6029    /// Round `x` to the nearest integer representable as a long
6030    ///
6031    /// Rounds `x` to the nearest integer. Values halfway between integers will be
6032    /// rounded away from zero.
6033    ///
6034    /// Domain: `-INF <= x <= INF`
6035    ///
6036    /// Range: `MIN_LONG <= y <= MAX_LONG`
6037    ///
6038    /// This function operates on single-precision floating point values, use
6039    /// [`SDL_lround`] for double-precision floats. To get the result as a
6040    /// floating-point type, use [`SDL_roundf`].
6041    ///
6042    /// ## Parameters
6043    /// - `x`: floating point value.
6044    ///
6045    /// ## Return value
6046    /// Returns the nearest integer to `x`.
6047    ///
6048    /// ## Thread safety
6049    /// It is safe to call this function from any thread.
6050    ///
6051    /// ## Availability
6052    /// This function is available since SDL 3.2.0.
6053    ///
6054    /// ## See also
6055    /// - [`SDL_lround`]
6056    /// - [`SDL_roundf`]
6057    /// - [`SDL_floorf`]
6058    /// - [`SDL_ceilf`]
6059    /// - [`SDL_truncf`]
6060    pub safe fn SDL_lroundf(x: ::core::ffi::c_float) -> ::core::ffi::c_long;
6061}
6062
6063unsafe extern "C" {
6064    /// Scale `x` by an integer power of two.
6065    ///
6066    /// Multiplies `x` by the `n`th power of the floating point radix (always 2).
6067    ///
6068    /// Domain: `-INF <= x <= INF`, `n` integer
6069    ///
6070    /// Range: `-INF <= y <= INF`
6071    ///
6072    /// This function operates on double-precision floating point values, use
6073    /// [`SDL_scalbnf`] for single-precision floats.
6074    ///
6075    /// ## Parameters
6076    /// - `x`: floating point value to be scaled.
6077    /// - `n`: integer exponent.
6078    ///
6079    /// ## Return value
6080    /// Returns `x * 2^n`.
6081    ///
6082    /// ## Thread safety
6083    /// It is safe to call this function from any thread.
6084    ///
6085    /// ## Availability
6086    /// This function is available since SDL 3.2.0.
6087    ///
6088    /// ## See also
6089    /// - [`SDL_scalbnf`]
6090    /// - [`SDL_pow`]
6091    pub safe fn SDL_scalbn(
6092        x: ::core::ffi::c_double,
6093        n: ::core::ffi::c_int,
6094    ) -> ::core::ffi::c_double;
6095}
6096
6097unsafe extern "C" {
6098    /// Scale `x` by an integer power of two.
6099    ///
6100    /// Multiplies `x` by the `n`th power of the floating point radix (always 2).
6101    ///
6102    /// Domain: `-INF <= x <= INF`, `n` integer
6103    ///
6104    /// Range: `-INF <= y <= INF`
6105    ///
6106    /// This function operates on single-precision floating point values, use
6107    /// [`SDL_scalbn`] for double-precision floats.
6108    ///
6109    /// ## Parameters
6110    /// - `x`: floating point value to be scaled.
6111    /// - `n`: integer exponent.
6112    ///
6113    /// ## Return value
6114    /// Returns `x * 2^n`.
6115    ///
6116    /// ## Thread safety
6117    /// It is safe to call this function from any thread.
6118    ///
6119    /// ## Availability
6120    /// This function is available since SDL 3.2.0.
6121    ///
6122    /// ## See also
6123    /// - [`SDL_scalbn`]
6124    /// - [`SDL_powf`]
6125    pub safe fn SDL_scalbnf(x: ::core::ffi::c_float, n: ::core::ffi::c_int)
6126    -> ::core::ffi::c_float;
6127}
6128
6129unsafe extern "C" {
6130    /// Compute the sine of `x`.
6131    ///
6132    /// Domain: `-INF <= x <= INF`
6133    ///
6134    /// Range: `-1 <= y <= 1`
6135    ///
6136    /// This function operates on double-precision floating point values, use
6137    /// [`SDL_sinf`] for single-precision floats.
6138    ///
6139    /// This function may use a different approximation across different versions,
6140    /// platforms and configurations. i.e, it can return a different value given
6141    /// the same input on different machines or operating systems, or if SDL is
6142    /// updated.
6143    ///
6144    /// ## Parameters
6145    /// - `x`: floating point value, in radians.
6146    ///
6147    /// ## Return value
6148    /// Returns sine of `x`.
6149    ///
6150    /// ## Thread safety
6151    /// It is safe to call this function from any thread.
6152    ///
6153    /// ## Availability
6154    /// This function is available since SDL 3.2.0.
6155    ///
6156    /// ## See also
6157    /// - [`SDL_sinf`]
6158    /// - [`SDL_asin`]
6159    /// - [`SDL_cos`]
6160    pub safe fn SDL_sin(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
6161}
6162
6163unsafe extern "C" {
6164    /// Compute the sine of `x`.
6165    ///
6166    /// Domain: `-INF <= x <= INF`
6167    ///
6168    /// Range: `-1 <= y <= 1`
6169    ///
6170    /// This function operates on single-precision floating point values, use
6171    /// [`SDL_sin`] for double-precision floats.
6172    ///
6173    /// This function may use a different approximation across different versions,
6174    /// platforms and configurations. i.e, it can return a different value given
6175    /// the same input on different machines or operating systems, or if SDL is
6176    /// updated.
6177    ///
6178    /// ## Parameters
6179    /// - `x`: floating point value, in radians.
6180    ///
6181    /// ## Return value
6182    /// Returns sine of `x`.
6183    ///
6184    /// ## Thread safety
6185    /// It is safe to call this function from any thread.
6186    ///
6187    /// ## Availability
6188    /// This function is available since SDL 3.2.0.
6189    ///
6190    /// ## See also
6191    /// - [`SDL_sin`]
6192    /// - [`SDL_asinf`]
6193    /// - [`SDL_cosf`]
6194    pub safe fn SDL_sinf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
6195}
6196
6197unsafe extern "C" {
6198    /// Compute the square root of `x`.
6199    ///
6200    /// Domain: `0 <= x <= INF`
6201    ///
6202    /// Range: `0 <= y <= INF`
6203    ///
6204    /// This function operates on double-precision floating point values, use
6205    /// [`SDL_sqrtf`] for single-precision floats.
6206    ///
6207    /// This function may use a different approximation across different versions,
6208    /// platforms and configurations. i.e, it can return a different value given
6209    /// the same input on different machines or operating systems, or if SDL is
6210    /// updated.
6211    ///
6212    /// ## Parameters
6213    /// - `x`: floating point value. Must be greater than or equal to 0.
6214    ///
6215    /// ## Return value
6216    /// Returns square root of `x`.
6217    ///
6218    /// ## Thread safety
6219    /// It is safe to call this function from any thread.
6220    ///
6221    /// ## Availability
6222    /// This function is available since SDL 3.2.0.
6223    ///
6224    /// ## See also
6225    /// - [`SDL_sqrtf`]
6226    pub safe fn SDL_sqrt(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
6227}
6228
6229unsafe extern "C" {
6230    /// Compute the square root of `x`.
6231    ///
6232    /// Domain: `0 <= x <= INF`
6233    ///
6234    /// Range: `0 <= y <= INF`
6235    ///
6236    /// This function operates on single-precision floating point values, use
6237    /// [`SDL_sqrt`] for double-precision floats.
6238    ///
6239    /// This function may use a different approximation across different versions,
6240    /// platforms and configurations. i.e, it can return a different value given
6241    /// the same input on different machines or operating systems, or if SDL is
6242    /// updated.
6243    ///
6244    /// ## Parameters
6245    /// - `x`: floating point value. Must be greater than or equal to 0.
6246    ///
6247    /// ## Return value
6248    /// Returns square root of `x`.
6249    ///
6250    /// ## Thread safety
6251    /// It is safe to call this function from any thread.
6252    ///
6253    /// ## Availability
6254    /// This function is available since SDL 3.2.0.
6255    ///
6256    /// ## See also
6257    /// - [`SDL_sqrt`]
6258    pub safe fn SDL_sqrtf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
6259}
6260
6261unsafe extern "C" {
6262    /// Compute the tangent of `x`.
6263    ///
6264    /// Domain: `-INF <= x <= INF`
6265    ///
6266    /// Range: `-INF <= y <= INF`
6267    ///
6268    /// This function operates on double-precision floating point values, use
6269    /// [`SDL_tanf`] for single-precision floats.
6270    ///
6271    /// This function may use a different approximation across different versions,
6272    /// platforms and configurations. i.e, it can return a different value given
6273    /// the same input on different machines or operating systems, or if SDL is
6274    /// updated.
6275    ///
6276    /// ## Parameters
6277    /// - `x`: floating point value, in radians.
6278    ///
6279    /// ## Return value
6280    /// Returns tangent of `x`.
6281    ///
6282    /// ## Thread safety
6283    /// It is safe to call this function from any thread.
6284    ///
6285    /// ## Availability
6286    /// This function is available since SDL 3.2.0.
6287    ///
6288    /// ## See also
6289    /// - [`SDL_tanf`]
6290    /// - [`SDL_sin`]
6291    /// - [`SDL_cos`]
6292    /// - [`SDL_atan`]
6293    /// - [`SDL_atan2`]
6294    pub safe fn SDL_tan(x: ::core::ffi::c_double) -> ::core::ffi::c_double;
6295}
6296
6297unsafe extern "C" {
6298    /// Compute the tangent of `x`.
6299    ///
6300    /// Domain: `-INF <= x <= INF`
6301    ///
6302    /// Range: `-INF <= y <= INF`
6303    ///
6304    /// This function operates on single-precision floating point values, use
6305    /// [`SDL_tan`] for double-precision floats.
6306    ///
6307    /// This function may use a different approximation across different versions,
6308    /// platforms and configurations. i.e, it can return a different value given
6309    /// the same input on different machines or operating systems, or if SDL is
6310    /// updated.
6311    ///
6312    /// ## Parameters
6313    /// - `x`: floating point value, in radians.
6314    ///
6315    /// ## Return value
6316    /// Returns tangent of `x`.
6317    ///
6318    /// ## Thread safety
6319    /// It is safe to call this function from any thread.
6320    ///
6321    /// ## Availability
6322    /// This function is available since SDL 3.2.0.
6323    ///
6324    /// ## See also
6325    /// - [`SDL_tan`]
6326    /// - [`SDL_sinf`]
6327    /// - [`SDL_cosf`]
6328    /// - [`SDL_atanf`]
6329    /// - [`SDL_atan2f`]
6330    pub safe fn SDL_tanf(x: ::core::ffi::c_float) -> ::core::ffi::c_float;
6331}
6332
6333/// An opaque handle representing string encoding conversion state.
6334///
6335/// ## Availability
6336/// This datatype is available since SDL 3.2.0.
6337///
6338/// ## See also
6339/// - [`SDL_iconv_open`]
6340pub type SDL_iconv_t = *mut SDL_iconv_data_t;
6341
6342unsafe extern "C" {
6343    /// This function allocates a context for the specified character set
6344    /// conversion.
6345    ///
6346    /// ## Parameters
6347    /// - `tocode`: The target character encoding, must not be NULL.
6348    /// - `fromcode`: The source character encoding, must not be NULL.
6349    ///
6350    /// ## Return value
6351    /// Returns a handle that must be freed with [`SDL_iconv_close`], or
6352    ///   [`SDL_ICONV_ERROR`] on failure.
6353    ///
6354    /// ## Thread safety
6355    /// It is safe to call this function from any thread.
6356    ///
6357    /// ## Availability
6358    /// This function is available since SDL 3.2.0.
6359    ///
6360    /// ## See also
6361    /// - [`SDL_iconv`]
6362    /// - [`SDL_iconv_close`]
6363    /// - [`SDL_iconv_string`]
6364    pub fn SDL_iconv_open(
6365        tocode: *const ::core::ffi::c_char,
6366        fromcode: *const ::core::ffi::c_char,
6367    ) -> SDL_iconv_t;
6368}
6369
6370unsafe extern "C" {
6371    /// This function frees a context used for character set conversion.
6372    ///
6373    /// ## Parameters
6374    /// - `cd`: The character set conversion handle.
6375    ///
6376    /// ## Return value
6377    /// Returns 0 on success, or -1 on failure.
6378    ///
6379    /// ## Thread safety
6380    /// It is safe to call this function from any thread.
6381    ///
6382    /// ## Availability
6383    /// This function is available since SDL 3.2.0.
6384    ///
6385    /// ## See also
6386    /// - [`SDL_iconv`]
6387    /// - [`SDL_iconv_open`]
6388    /// - [`SDL_iconv_string`]
6389    pub fn SDL_iconv_close(cd: SDL_iconv_t) -> ::core::ffi::c_int;
6390}
6391
6392unsafe extern "C" {
6393    /// This function converts text between encodings, reading from and writing to
6394    /// a buffer.
6395    ///
6396    /// It returns the number of successful conversions on success. On error,
6397    /// [`SDL_ICONV_E2BIG`] is returned when the output buffer is too small, or
6398    /// [`SDL_ICONV_EILSEQ`] is returned when an invalid input sequence is encountered,
6399    /// or [`SDL_ICONV_EINVAL`] is returned when an incomplete input sequence is
6400    /// encountered.
6401    ///
6402    /// On exit:
6403    ///
6404    /// - inbuf will point to the beginning of the next multibyte sequence. On
6405    ///   error, this is the location of the problematic input sequence. On
6406    ///   success, this is the end of the input sequence.
6407    /// - inbytesleft will be set to the number of bytes left to convert, which
6408    ///   will be 0 on success.
6409    /// - outbuf will point to the location where to store the next output byte.
6410    /// - outbytesleft will be set to the number of bytes left in the output
6411    ///   buffer.
6412    ///
6413    /// ## Parameters
6414    /// - `cd`: The character set conversion context, created in
6415    ///   [`SDL_iconv_open()`].
6416    /// - `inbuf`: Address of variable that points to the first character of the
6417    ///   input sequence.
6418    /// - `inbytesleft`: The number of bytes in the input buffer.
6419    /// - `outbuf`: Address of variable that points to the output buffer.
6420    /// - `outbytesleft`: The number of bytes in the output buffer.
6421    ///
6422    /// ## Return value
6423    /// Returns the number of conversions on success, or a negative error code.
6424    ///
6425    /// ## Thread safety
6426    /// Do not use the same [`SDL_iconv_t`] from two threads at once.
6427    ///
6428    /// ## Availability
6429    /// This function is available since SDL 3.2.0.
6430    ///
6431    /// ## See also
6432    /// - [`SDL_iconv_open`]
6433    /// - [`SDL_iconv_close`]
6434    /// - [`SDL_iconv_string`]
6435    pub fn SDL_iconv(
6436        cd: SDL_iconv_t,
6437        inbuf: *mut *const ::core::ffi::c_char,
6438        inbytesleft: *mut ::core::primitive::usize,
6439        outbuf: *mut *mut ::core::ffi::c_char,
6440        outbytesleft: *mut ::core::primitive::usize,
6441    ) -> ::core::primitive::usize;
6442}
6443
6444/// Generic error. Check [`SDL_GetError()`]?
6445pub const SDL_ICONV_ERROR: ::core::primitive::usize = (-1_i32 as ::core::primitive::usize);
6446
6447/// Output buffer was too small.
6448pub const SDL_ICONV_E2BIG: ::core::primitive::usize = (-2_i32 as ::core::primitive::usize);
6449
6450/// Invalid input sequence was encountered.
6451pub const SDL_ICONV_EILSEQ: ::core::primitive::usize = (-3_i32 as ::core::primitive::usize);
6452
6453/// Incomplete input sequence was encountered.
6454pub const SDL_ICONV_EINVAL: ::core::primitive::usize = (-4_i32 as ::core::primitive::usize);
6455
6456unsafe extern "C" {
6457    /// Helper function to convert a string's encoding in one call.
6458    ///
6459    /// This function converts a buffer or string between encodings in one pass.
6460    ///
6461    /// The string does not need to be NULL-terminated; this function operates on
6462    /// the number of bytes specified in `inbytesleft` whether there is a NULL
6463    /// character anywhere in the buffer.
6464    ///
6465    /// The returned string is owned by the caller, and should be passed to
6466    /// [`SDL_free`] when no longer needed.
6467    ///
6468    /// ## Parameters
6469    /// - `tocode`: the character encoding of the output string. Examples are
6470    ///   "UTF-8", "UCS-4", etc.
6471    /// - `fromcode`: the character encoding of data in `inbuf`.
6472    /// - `inbuf`: the string to convert to a different encoding.
6473    /// - `inbytesleft`: the size of the input string _in bytes_.
6474    ///
6475    /// ## Return value
6476    /// Returns a new string, converted to the new encoding, or NULL on error.
6477    ///
6478    /// ## Thread safety
6479    /// It is safe to call this function from any thread.
6480    ///
6481    /// ## Availability
6482    /// This function is available since SDL 3.2.0.
6483    ///
6484    /// ## See also
6485    /// - [`SDL_iconv_open`]
6486    /// - [`SDL_iconv_close`]
6487    /// - [`SDL_iconv`]
6488    pub fn SDL_iconv_string(
6489        tocode: *const ::core::ffi::c_char,
6490        fromcode: *const ::core::ffi::c_char,
6491        inbuf: *const ::core::ffi::c_char,
6492        inbytesleft: ::core::primitive::usize,
6493    ) -> *mut ::core::ffi::c_char;
6494}
6495
6496/// Convert a UTF-8 string to the current locale's character encoding.
6497///
6498/// This is a helper macro that might be more clear than calling
6499/// [`SDL_iconv_string`] directly. However, it double-evaluates its parameter, so
6500/// do not use an expression with side-effects here.
6501///
6502/// ## Parameters
6503/// - `S`: the string to convert.
6504///
6505/// ## Return value
6506/// Returns a new string, converted to the new encoding, or NULL on error.
6507///
6508/// ## Thread safety
6509/// It is safe to call this macro from any thread.
6510///
6511/// ## Availability
6512/// This macro is available since SDL 3.2.0.
6513#[inline(always)]
6514pub unsafe fn SDL_iconv_utf8_locale(S: *const ::core::ffi::c_char) -> *mut ::core::ffi::c_char {
6515    unsafe {
6516        SDL_iconv_string(
6517            c"".as_ptr(),
6518            c"UTF-8".as_ptr(),
6519            S,
6520            (unsafe { SDL_strlen(S) } + 1_usize),
6521        )
6522    }
6523}
6524
6525/// Convert a UTF-8 string to UCS-2.
6526///
6527/// This is a helper macro that might be more clear than calling
6528/// [`SDL_iconv_string`] directly. However, it double-evaluates its parameter, so
6529/// do not use an expression with side-effects here.
6530///
6531/// ## Parameters
6532/// - `S`: the string to convert.
6533///
6534/// ## Return value
6535/// Returns a new string, converted to the new encoding, or NULL on error.
6536///
6537/// ## Thread safety
6538/// It is safe to call this macro from any thread.
6539///
6540/// ## Availability
6541/// This macro is available since SDL 3.2.0.
6542#[inline(always)]
6543pub unsafe fn SDL_iconv_utf8_ucs2(S: *const ::core::ffi::c_char) -> *mut Uint16 {
6544    (unsafe {
6545        SDL_iconv_string(
6546            c"UCS-2".as_ptr(),
6547            c"UTF-8".as_ptr(),
6548            S,
6549            (unsafe { SDL_strlen(S) } + 1_usize),
6550        )
6551    } as *mut Uint16)
6552}
6553
6554/// Convert a UTF-8 string to UCS-4.
6555///
6556/// This is a helper macro that might be more clear than calling
6557/// [`SDL_iconv_string`] directly. However, it double-evaluates its parameter, so
6558/// do not use an expression with side-effects here.
6559///
6560/// ## Parameters
6561/// - `S`: the string to convert.
6562///
6563/// ## Return value
6564/// Returns a new string, converted to the new encoding, or NULL on error.
6565///
6566/// ## Thread safety
6567/// It is safe to call this macro from any thread.
6568///
6569/// ## Availability
6570/// This macro is available since SDL 3.2.0.
6571#[inline(always)]
6572pub unsafe fn SDL_iconv_utf8_ucs4(S: *const ::core::ffi::c_char) -> *mut Uint32 {
6573    (unsafe {
6574        SDL_iconv_string(
6575            c"UCS-4".as_ptr(),
6576            c"UTF-8".as_ptr(),
6577            S,
6578            (unsafe { SDL_strlen(S) } + 1_usize),
6579        )
6580    } as *mut Uint32)
6581}
6582
6583/// Convert a wchar_t string to UTF-8.
6584///
6585/// This is a helper macro that might be more clear than calling
6586/// [`SDL_iconv_string`] directly. However, it double-evaluates its parameter, so
6587/// do not use an expression with side-effects here.
6588///
6589/// ## Parameters
6590/// - `S`: the string to convert.
6591///
6592/// ## Return value
6593/// Returns a new string, converted to the new encoding, or NULL on error.
6594///
6595/// ## Thread safety
6596/// It is safe to call this macro from any thread.
6597///
6598/// ## Availability
6599/// This macro is available since SDL 3.2.0.
6600#[inline(always)]
6601pub unsafe fn SDL_iconv_wchar_utf8(S: *const crate::ffi::c_wchar_t) -> *mut ::core::ffi::c_char {
6602    unsafe {
6603        SDL_iconv_string(
6604            c"UTF-8".as_ptr(),
6605            c"WCHAR_T".as_ptr(),
6606            (S as *const ::core::ffi::c_char),
6607            ((unsafe { SDL_wcslen(S) } + 1_usize)
6608                * ::core::mem::size_of::<crate::ffi::c_wchar_t>()),
6609        )
6610    }
6611}
6612
6613/// Multiply two integers, checking for overflow.
6614///
6615/// If `a * b` would overflow, return false.
6616///
6617/// Otherwise store `a * b` via ret and return true.
6618///
6619/// ## Parameters
6620/// - `a`: the multiplicand.
6621/// - `b`: the multiplier.
6622/// - `ret`: on non-overflow output, stores the multiplication result, may
6623///   not be NULL.
6624///
6625/// ## Return value
6626/// Returns false on overflow, true if result is multiplied without overflow.
6627///
6628/// ## Thread safety
6629/// It is safe to call this function from any thread.
6630///
6631/// ## Availability
6632/// This function is available since SDL 3.2.0.
6633#[inline(always)]
6634pub const unsafe fn SDL_size_mul_check_overflow(
6635    a: ::core::primitive::usize,
6636    b: ::core::primitive::usize,
6637    ret: *mut ::core::primitive::usize,
6638) -> ::core::primitive::bool {
6639    if ((a != 0_usize) && (b > (SDL_SIZE_MAX / a))) {
6640        return false;
6641    }
6642    unsafe {
6643        let (ptr, value) = (ret, (a * b));
6644        ptr.write(value);
6645        value
6646    };
6647    return true;
6648}
6649
6650apply_cfg!(#[cfg(not(doc))] => {
6651});
6652
6653/// Add two integers, checking for overflow.
6654///
6655/// If `a + b` would overflow, return false.
6656///
6657/// Otherwise store `a + b` via ret and return true.
6658///
6659/// ## Parameters
6660/// - `a`: the first addend.
6661/// - `b`: the second addend.
6662/// - `ret`: on non-overflow output, stores the addition result, may not be
6663///   NULL.
6664///
6665/// ## Return value
6666/// Returns false on overflow, true if result is added without overflow.
6667///
6668/// ## Thread safety
6669/// It is safe to call this function from any thread.
6670///
6671/// ## Availability
6672/// This function is available since SDL 3.2.0.
6673#[inline(always)]
6674pub const unsafe fn SDL_size_add_check_overflow(
6675    a: ::core::primitive::usize,
6676    b: ::core::primitive::usize,
6677    ret: *mut ::core::primitive::usize,
6678) -> ::core::primitive::bool {
6679    if (b > (SDL_SIZE_MAX - a)) {
6680        return false;
6681    }
6682    unsafe {
6683        let (ptr, value) = (ret, (a + b));
6684        ptr.write(value);
6685        value
6686    };
6687    return true;
6688}
6689
6690apply_cfg!(#[cfg(not(doc))] => {
6691});
6692
6693apply_cfg!(#[cfg(doc)] => {
6694    /// A generic function pointer.
6695    ///
6696    /// In theory, generic function pointers should use this, instead of `void *`,
6697    /// since some platforms could treat code addresses differently than data
6698    /// addresses. Although in current times no popular platforms make this
6699    /// distinction, it is more correct and portable to use the correct type for a
6700    /// generic pointer.
6701    ///
6702    /// If for some reason you need to force this typedef to be an actual `void *`,
6703    /// perhaps to work around a compiler or existing code, you can define
6704    /// `SDL_FUNCTION_POINTER_IS_VOID_POINTER` before including any SDL headers.
6705    ///
6706    /// ## Availability
6707    /// This datatype is available since SDL 3.2.0.
6708    pub type SDL_FunctionPointer = ::core::option::Option<unsafe extern "C" fn()>;
6709
6710});
6711
6712apply_cfg!(#[cfg(not(doc))] => {
6713    pub type SDL_FunctionPointer = ::core::option::Option<unsafe extern "C" fn()>;
6714
6715});
6716
6717/// A thread-safe set of environment variables
6718///
6719/// ## Availability
6720/// This struct is available since SDL 3.2.0.
6721///
6722/// ## See also
6723/// - [`SDL_GetEnvironment`]
6724/// - [`SDL_CreateEnvironment`]
6725/// - [`SDL_GetEnvironmentVariable`]
6726/// - [`SDL_GetEnvironmentVariables`]
6727/// - [`SDL_SetEnvironmentVariable`]
6728/// - [`SDL_UnsetEnvironmentVariable`]
6729/// - [`SDL_DestroyEnvironment`]
6730#[repr(C)]
6731pub struct SDL_Environment {
6732    _opaque: [::core::primitive::u8; 0],
6733}
6734
6735#[repr(C)]
6736pub struct SDL_iconv_data_t {
6737    _opaque: [::core::primitive::u8; 0],
6738}
6739
6740#[cfg(doc)]
6741use crate::everything::*;