diff options
author | A.J. Gardner <aaron.j.gardner@gmail.com> | 2016-03-30 00:36:43 -0500 |
---|---|---|
committer | A.J. Gardner <aaron.j.gardner@gmail.com> | 2016-03-30 00:36:43 -0500 |
commit | 110152c11526957dffbaba5a09471e9608ee8881 (patch) | |
tree | 6f9c08119309ee35c5ad764d4e3d7f66e77dd966 | |
parent | cd925e0ce1958b3e8561932cbe1fad5b328a8b95 (diff) | |
download | rust-libc-110152c11526957dffbaba5a09471e9608ee8881.tar.gz |
Add lconv type, and locale support for UNIX
We have lconv struct, setlocale(), and localeconv(). Constants live
under notbsd for now.
-rw-r--r-- | src/unix/mod.rs | 29 | ||||
-rw-r--r-- | src/unix/notbsd/mod.rs | 14 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 77b24f229f..ea1e8555ff 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -106,6 +106,33 @@ s! { pub ws_xpixel: ::c_ushort, pub ws_ypixel: ::c_ushort, } + + pub struct lconv { + pub decimal_point: *mut ::c_char, + pub thousands_sep: *mut ::c_char, + pub grouping: *mut ::c_char, + pub int_curr_symbol: *mut ::c_char, + pub currency_symbol: *mut ::c_char, + pub mon_decimal_point: *mut ::c_char, + pub mon_thousands_sep: *mut ::c_char, + pub mon_grouping: *mut ::c_char, + pub positive_sign: *mut ::c_char, + pub negative_sign: *mut ::c_char, + pub int_frac_digits: ::c_char, + pub frac_digits: ::c_char, + pub p_cs_precedes: ::c_char, + pub p_sep_by_space: ::c_char, + pub n_cs_precedes: ::c_char, + pub n_sep_by_space: ::c_char, + pub p_sign_posn: ::c_char, + pub n_sign_posn: ::c_char, + pub int_p_cs_precedes: ::c_char, + pub int_p_sep_by_space: ::c_char, + pub int_n_cs_precedes: ::c_char, + pub int_n_sep_by_space: ::c_char, + pub int_p_sign_posn: ::c_char, + pub int_n_sign_posn: ::c_char, + } } pub const SIG_DFL: sighandler_t = 0 as sighandler_t; @@ -611,6 +638,8 @@ extern { writefds: *mut fd_set, errorfds: *mut fd_set, timeout: *mut timeval) -> ::c_int; + pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char; + pub fn localeconv() -> *mut lconv; } // TODO: get rid of this cfg(not(...)) diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index d9d2013178..73f63c3823 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -244,6 +244,20 @@ pub const PROT_READ: ::c_int = 1; pub const PROT_WRITE: ::c_int = 2; pub const PROT_EXEC: ::c_int = 4; +pub const LC_CTYPE: ::c_int = 0; +pub const LC_NUMERIC: ::c_int = 1; +pub const LC_TIME: ::c_int = 2; +pub const LC_COLLATE: ::c_int = 3; +pub const LC_MONETARY: ::c_int = 4; +pub const LC_MESSAGES: ::c_int = 5; +pub const LC_ALL: ::c_int = 6; +pub const LC_PAPER: ::c_int = 7; +pub const LC_NAME: ::c_int = 8; +pub const LC_ADDRESS: ::c_int = 9; +pub const LC_TELEPHONE: ::c_int = 10; +pub const LC_MEASUREMENT: ::c_int = 11; +pub const LC_IDENTIFICATION: ::c_int = 12; + pub const MAP_FILE: ::c_int = 0x0000; pub const MAP_SHARED: ::c_int = 0x0001; pub const MAP_PRIVATE: ::c_int = 0x0002; |