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