1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#![no_std]
#![allow(non_camel_case_types)]
#![allow(unused_attributes)]

// Special: Platforms with unsigned character types
#![cfg_attr(
	any(
		target_arch = "aarch64",
		target_arch = "arm",
		target_arch = "powerpc",
		target_arch = "powerpc64"
	),
	target_arch_char_unsigned
)]

// Character types
pub type c_schar = i8;
pub type c_uchar = u8;
#[cfg(not(target_arch_char_unsigned))]
pub type c_char  = i8;
#[cfg(target_arch_char_unsigned)]
pub type c_char  = u8;
#[cfg(not(target_arch_char_unsigned))]
pub type c_wchar = i32;
#[cfg(target_arch_char_unsigned)]
pub type c_wchar = u32;

// Standard integers
pub type c_short     = i16;
pub type c_ushort    = u16;

pub type c_int       = i32;
pub type c_uint      = u32;

#[cfg(target_pointer_width = "32")]
pub type c_long      = i32;
#[cfg(target_pointer_width = "32")]
pub type c_ulong     = u32;
#[cfg(target_pointer_width = "64")]
pub type c_long      = i64;
#[cfg(target_pointer_width = "64")]
pub type c_ulong     = u64;

pub type c_longlong  = i64;
pub type c_ulonglong = u64;

// Float point type (not usable, but they do exist)
pub type c_float  = f32;
pub type c_double = f64;

// The special "size" type
#[cfg(target_pointer_width = "32")]
pub type c_size_t = u32;
#[cfg(target_pointer_width = "64")]
pub type c_size_t = u64;

/// Magic pointer that represents a `void*` in C
/// See `libstd/os/raw.rs:48` from the Rust source code for details…
#[repr(u8)]
pub enum c_void {
	#[doc(hidden)] __variant1,
	#[doc(hidden)] __variant2
}