relibc/header/langinfo/
mod.rs1use crate::{header::bits_locale_t::locale_t, platform::types::size_t};
8use core::ffi::c_char;
9
10pub type nl_item = size_t;
16
17static STRING_TABLE: [&[u8]; 81] = [
20 b"UTF-8\0", b"%a %b %e %H:%M:%S %Y\0", b"%m/%d/%y\0", b"%H:%M:%S\0", b"%I:%M:%S %p\0", b"AM\0", b"PM\0", b"Sunday\0", b"Monday\0", b"Tuesday\0", b"Wednesday\0", b"Thursday\0", b"Friday\0", b"Saturday\0", b"Sun\0", b"Mon\0", b"Tue\0", b"Wed\0", b"Thu\0", b"Fri\0", b"Sat\0", b"January\0", b"February\0", b"March\0", b"April\0", b"May\0", b"June\0", b"July\0", b"August\0", b"September\0", b"October\0", b"November\0", b"December\0", b"Jan\0", b"Feb\0", b"Mar\0", b"Apr\0", b"May\0", b"Jun\0", b"Jul\0", b"Aug\0", b"Sep\0", b"Oct\0", b"Nov\0", b"Dec\0", b"\0", b"\0", b"\0", b"\0", b"\0", b".\0", b"\0", b"^[yY]\0", b"^[nN]\0", b"yes\0", b"no\0", b".\0", b"January\0", b"February\0", b"March\0", b"April\0", b"May\0", b"June\0", b"July\0", b"August\0", b"September\0", b"October\0", b"November\0", b"December\0", b"Jan\0", b"Feb\0", b"Mar\0", b"Apr\0", b"May\0", b"Jun\0", b"Jul\0", b"Aug\0", b"Sep\0", b"Oct\0", b"Nov\0", b"Dec\0", ];
104
105pub const CODESET: nl_item = 0;
107pub const D_T_FMT: nl_item = 1;
108pub const D_FMT: nl_item = 2;
109pub const T_FMT: nl_item = 3;
110pub const T_FMT_AMPM: nl_item = 4;
111pub const AM_STR: nl_item = 5;
112pub const PM_STR: nl_item = 6;
113
114pub const DAY_1: nl_item = 7;
115pub const DAY_2: nl_item = 8;
116pub const DAY_3: nl_item = 9;
117pub const DAY_4: nl_item = 10;
118pub const DAY_5: nl_item = 11;
119pub const DAY_6: nl_item = 12;
120pub const DAY_7: nl_item = 13;
121
122pub const ABDAY_1: nl_item = 14;
123pub const ABDAY_2: nl_item = 15;
124pub const ABDAY_3: nl_item = 16;
125pub const ABDAY_4: nl_item = 17;
126pub const ABDAY_5: nl_item = 18;
127pub const ABDAY_6: nl_item = 19;
128pub const ABDAY_7: nl_item = 20;
129
130pub const MON_1: nl_item = 21;
131pub const MON_2: nl_item = 22;
132pub const MON_3: nl_item = 23;
133pub const MON_4: nl_item = 24;
134pub const MON_5: nl_item = 25;
135pub const MON_6: nl_item = 26;
136pub const MON_7: nl_item = 27;
137pub const MON_8: nl_item = 28;
138pub const MON_9: nl_item = 29;
139pub const MON_10: nl_item = 30;
140pub const MON_11: nl_item = 31;
141pub const MON_12: nl_item = 32;
142
143pub const ABMON_1: nl_item = 33;
144pub const ABMON_2: nl_item = 34;
145pub const ABMON_3: nl_item = 35;
146pub const ABMON_4: nl_item = 36;
147pub const ABMON_5: nl_item = 37;
148pub const ABMON_6: nl_item = 38;
149pub const ABMON_7: nl_item = 39;
150pub const ABMON_8: nl_item = 40;
151pub const ABMON_9: nl_item = 41;
152pub const ABMON_10: nl_item = 42;
153pub const ABMON_11: nl_item = 43;
154pub const ABMON_12: nl_item = 44;
155
156pub const ERA: nl_item = 45;
157pub const ERA_D_FMT: nl_item = 46;
158pub const ERA_D_T_FMT: nl_item = 47;
159pub const ERA_T_FMT: nl_item = 48;
160pub const ALT_DIGITS: nl_item = 49;
161pub const RADIXCHAR: nl_item = 50;
162pub const THOUSEP: nl_item = 51;
163pub const YESEXPR: nl_item = 52;
164pub const NOEXPR: nl_item = 53;
165pub const YESSTR: nl_item = 54; pub const NOSTR: nl_item = 55; pub const CRNCYSTR: nl_item = 56;
168
169pub const ALTMON_1: nl_item = 57;
170pub const ALTMON_2: nl_item = 58;
171pub const ALTMON_3: nl_item = 59;
172pub const ALTMON_4: nl_item = 60;
173pub const ALTMON_5: nl_item = 61;
174pub const ALTMON_6: nl_item = 62;
175pub const ALTMON_7: nl_item = 63;
176pub const ALTMON_8: nl_item = 64;
177pub const ALTMON_9: nl_item = 65;
178pub const ALTMON_10: nl_item = 66;
179pub const ALTMON_11: nl_item = 67;
180pub const ALTMON_12: nl_item = 68;
181
182pub const ABALTMON_1: nl_item = 69;
183pub const ABALTMON_2: nl_item = 70;
184pub const ABALTMON_3: nl_item = 71;
185pub const ABALTMON_4: nl_item = 72;
186pub const ABALTMON_5: nl_item = 73;
187pub const ABALTMON_6: nl_item = 74;
188pub const ABALTMON_7: nl_item = 75;
189pub const ABALTMON_8: nl_item = 76;
190pub const ABALTMON_9: nl_item = 77;
191pub const ABALTMON_10: nl_item = 78;
192pub const ABALTMON_11: nl_item = 79;
193pub const ABALTMON_12: nl_item = 80;
194
195#[unsafe(no_mangle)]
204pub unsafe extern "C" fn nl_langinfo(item: nl_item) -> *mut c_char {
205 let ptr = if item < STRING_TABLE.len() {
207 STRING_TABLE[item].as_ptr().cast::<c_char>()
208 } else {
209 c"".as_ptr().cast::<c_char>()
211 };
212 ptr.cast_mut()
214}
215
216#[unsafe(no_mangle)]
225pub unsafe extern "C" fn nl_langinfo_l(item: nl_item, _loc: locale_t) -> *mut c_char {
226 unsafe { nl_langinfo(item) }
227}