1// Take a look at the license at the top of the repository in the LICENSE file.
2
3#[cfg(unix)]
4pub use libc::passwd;
5#[allow(unused_imports)]
6use libc::{c_char, c_int, c_ushort, c_void};
7
8#[cfg(all(not(unix), docsrs))]
9#[repr(C)]
10pub 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)]
21pub type GPid = *mut c_void;
22
23#[cfg(not(windows))]
24pub type GPid = c_int;
25
26#[repr(C)]
27#[derive(Copy, Clone)]
28#[cfg(all(windows, target_arch = "x86_64"))]
29pub 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")))]
38pub struct GPollFD {
39 pub fd: c_int,
40 pub events: c_ushort,
41 pub revents: c_ushort,
42}
43
44#[cfg(target_family = "windows")]
45pub use self::win32::*;
46
47#[cfg(target_family = "windows")]
48mod 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
81pub const G_VARIANT_TYPE_BOOLEAN: &str = "b";
82pub const G_VARIANT_TYPE_BYTE: &str = "y";
83pub const G_VARIANT_TYPE_INT16: &str = "n";
84pub const G_VARIANT_TYPE_UINT16: &str = "q";
85pub const G_VARIANT_TYPE_INT32: &str = "i";
86pub const G_VARIANT_TYPE_UINT32: &str = "u";
87pub const G_VARIANT_TYPE_INT64: &str = "x";
88pub const G_VARIANT_TYPE_UINT64: &str = "t";
89pub const G_VARIANT_TYPE_DOUBLE: &str = "d";
90pub const G_VARIANT_TYPE_STRING: &str = "s";
91pub const G_VARIANT_TYPE_OBJECT_PATH: &str = "o";
92pub const G_VARIANT_TYPE_SIGNATURE: &str = "g";
93pub const G_VARIANT_TYPE_VARIANT: &str = "v";
94pub const G_VARIANT_TYPE_HANDLE: &str = "h";
95pub const G_VARIANT_TYPE_UNIT: &str = "()";
96pub const G_VARIANT_TYPE_ANY: &str = "*";
97pub const G_VARIANT_TYPE_BASIC: &str = "?";
98pub const G_VARIANT_TYPE_MAYBE: &str = "m*";
99pub const G_VARIANT_TYPE_ARRAY: &str = "a*";
100pub const G_VARIANT_TYPE_TUPLE: &str = "r";
101pub const G_VARIANT_TYPE_DICT_ENTRY: &str = "{?*}";
102pub const G_VARIANT_TYPE_DICTIONARY: &str = "a{?*}";
103pub const G_VARIANT_TYPE_STRING_ARRAY: &str = "as";
104pub const G_VARIANT_TYPE_OBJECT_PATH_ARRAY: &str = "ao";
105pub const G_VARIANT_TYPE_BYTE_STRING: &str = "ay";
106pub const G_VARIANT_TYPE_BYTE_STRING_ARRAY: &str = "ayy";
107pub const G_VARIANT_TYPE_VARDICT: &str = "a{sv}";
108