1 | // Take a look at the license at the top of the repository in the LICENSE file. |
2 | |
3 | #[cfg (unix)] |
4 | pub use libc::passwd; |
5 | #[allow (unused_imports)] |
6 | use libc::{c_char, c_int, c_ushort, c_void}; |
7 | |
8 | pub type GType = libc::size_t; |
9 | |
10 | #[cfg (all(not(unix), docsrs))] |
11 | #[repr (C)] |
12 | pub struct passwd { |
13 | pw_name: *mut c_char, |
14 | pw_passwd: *mut c_char, |
15 | pw_uid: u32, |
16 | pw_gid: u32, |
17 | pw_gecos: *mut c_char, |
18 | pw_dir: *mut c_char, |
19 | pw_shell: *mut c_char, |
20 | } |
21 | |
22 | #[cfg (windows)] |
23 | pub type GPid = *mut c_void; |
24 | |
25 | #[cfg (not(windows))] |
26 | pub type GPid = libc::pid_t; |
27 | |
28 | #[repr (C)] |
29 | #[derive (Copy, Clone)] |
30 | #[cfg (all(windows, target_arch = "x86_64" ))] |
31 | pub struct GPollFD { |
32 | pub fd: i64, |
33 | pub events: c_ushort, |
34 | pub revents: c_ushort, |
35 | } |
36 | |
37 | #[repr (C)] |
38 | #[derive (Copy, Clone)] |
39 | #[cfg (not(all(windows, target_arch = "x86_64" )))] |
40 | pub struct GPollFD { |
41 | pub fd: c_int, |
42 | pub events: c_ushort, |
43 | pub revents: c_ushort, |
44 | } |
45 | |
46 | // These are all non-NUL terminated strings in C |
47 | pub const G_VARIANT_TYPE_BOOLEAN: &str = "b" ; |
48 | pub const G_VARIANT_TYPE_BYTE: &str = "y" ; |
49 | pub const G_VARIANT_TYPE_INT16: &str = "n" ; |
50 | pub const G_VARIANT_TYPE_UINT16: &str = "q" ; |
51 | pub const G_VARIANT_TYPE_INT32: &str = "i" ; |
52 | pub const G_VARIANT_TYPE_UINT32: &str = "u" ; |
53 | pub const G_VARIANT_TYPE_INT64: &str = "x" ; |
54 | pub const G_VARIANT_TYPE_UINT64: &str = "t" ; |
55 | pub const G_VARIANT_TYPE_DOUBLE: &str = "d" ; |
56 | pub const G_VARIANT_TYPE_STRING: &str = "s" ; |
57 | pub const G_VARIANT_TYPE_OBJECT_PATH: &str = "o" ; |
58 | pub const G_VARIANT_TYPE_SIGNATURE: &str = "g" ; |
59 | pub const G_VARIANT_TYPE_VARIANT: &str = "v" ; |
60 | pub const G_VARIANT_TYPE_HANDLE: &str = "h" ; |
61 | pub const G_VARIANT_TYPE_UNIT: &str = "()" ; |
62 | pub const G_VARIANT_TYPE_ANY: &str = "*" ; |
63 | pub const G_VARIANT_TYPE_BASIC: &str = "?" ; |
64 | pub const G_VARIANT_TYPE_MAYBE: &str = "m*" ; |
65 | pub const G_VARIANT_TYPE_ARRAY: &str = "a*" ; |
66 | pub const G_VARIANT_TYPE_TUPLE: &str = "r" ; |
67 | pub const G_VARIANT_TYPE_DICT_ENTRY: &str = "{?*}" ; |
68 | pub const G_VARIANT_TYPE_DICTIONARY: &str = "a{?*}" ; |
69 | pub const G_VARIANT_TYPE_STRING_ARRAY: &str = "as" ; |
70 | pub const G_VARIANT_TYPE_OBJECT_PATH_ARRAY: &str = "ao" ; |
71 | pub const G_VARIANT_TYPE_BYTE_STRING: &str = "ay" ; |
72 | pub const G_VARIANT_TYPE_BYTE_STRING_ARRAY: &str = "aay" ; |
73 | pub const G_VARIANT_TYPE_VARDICT: &str = "a{sv}" ; |
74 | |
75 | #[cfg (target_family = "windows" )] |
76 | pub use self::win32::*; |
77 | |
78 | #[cfg (target_family = "windows" )] |
79 | mod win32 { |
80 | use libc::{c_char, c_int, c_uint}; |
81 | |
82 | pub type GWin32OSType = c_int; |
83 | pub const G_WIN32_OS_ANY: GWin32OSType = 0; |
84 | pub const G_WIN32_OS_WORKSTATION: GWin32OSType = 1; |
85 | pub const G_WIN32_OS_SERVER: GWin32OSType = 2; |
86 | |
87 | extern "C" { |
88 | pub fn g_win32_check_windows_version( |
89 | major: c_int, |
90 | minor: c_int, |
91 | spver: c_int, |
92 | os_type: GWin32OSType, |
93 | ) -> crate::gboolean; |
94 | |
95 | pub fn g_win32_get_command_line() -> *mut *mut c_char; |
96 | |
97 | pub fn g_win32_error_message(error: c_int) -> *mut c_char; |
98 | |
99 | pub fn g_win32_getlocale() -> *mut c_char; |
100 | |
101 | pub fn g_win32_get_package_installation_directory_of_module( |
102 | hmodule: std::os::windows::raw::HANDLE, |
103 | ) -> *mut c_char; |
104 | |
105 | pub fn g_win32_locale_filename_from_utf8(utf8filename: *const c_char) -> *mut c_char; |
106 | |
107 | pub fn g_win32_ftruncate(f: c_int, size: c_uint) -> c_int; |
108 | pub fn g_win32_get_package_installation_directory( |
109 | package: *const c_char, |
110 | dll_name: *const c_char, |
111 | ) -> *mut c_char; |
112 | pub fn g_win32_get_package_installation_subdirectory( |
113 | package: *const c_char, |
114 | dll_name: *const c_char, |
115 | subdir: *const c_char, |
116 | ) -> *mut c_char; |
117 | pub fn g_win32_get_windows_version() -> c_uint; |
118 | } |
119 | } |
120 | |