|
1 /* |
|
2 * Copyright (c) 1999 |
|
3 * Silicon Graphics Computer Systems, Inc. |
|
4 * |
|
5 * Copyright (c) 1999 |
|
6 * Boris Fomitchev |
|
7 * |
|
8 * This material is provided "as is", with absolutely no warranty expressed |
|
9 * or implied. Any use is at your own risk. |
|
10 * |
|
11 * Permission to use or copy this software for any purpose is hereby granted |
|
12 * without fee, provided the above notices are retained on all copies. |
|
13 * Permission to modify the code and to distribute modified code is granted, |
|
14 * provided the above notices are retained, and a notice that the code was |
|
15 * modified is included with the above copyright notice. |
|
16 * |
|
17 */ |
|
18 |
|
19 /* This is a "stub" implementation of the "c_locale.h" interface, |
|
20 intended for operating systems where we have not yet written |
|
21 a real implementation. A C++ library using this stub implementation |
|
22 is still standard-conforming, since the C++ standard does not require |
|
23 that any locales other than "C" be supported. |
|
24 */ |
|
25 |
|
26 #include <string.h> |
|
27 #include <wchar.h> |
|
28 #include <ctype.h> |
|
29 #include <wctype.h> |
|
30 #include <limits.h> |
|
31 |
|
32 #if defined (_STLP_USE_SAFE_STRING_FUNCTIONS) |
|
33 # define _STLP_STRNCPY(D, DS, S, C) strncpy_s(D, DS, S, C) |
|
34 # if !defined (_STLP_NO_WCHAR_T) |
|
35 # define _STLP_WCSNCPY(D, DS, S, C) wcsncpy_s(D, DS, S, C) |
|
36 # endif |
|
37 #else |
|
38 # define _STLP_STRNCPY(D, DS, S, C) strncpy(D, S, C) |
|
39 # if !defined (_STLP_NO_WCHAR_T) |
|
40 # define _STLP_WCSNCPY(D, DS, S, C) wcsncpy(D, S, C) |
|
41 # endif |
|
42 #endif |
|
43 |
|
44 static const char *_C_name = "C"; |
|
45 static const char *_empty_str = ""; |
|
46 #ifndef _STLP_NO_WCHAR_T |
|
47 #if defined(WCHAR_MAX) && WCHAR_MAX == 255 |
|
48 static const wchar_t *_empty_wstr = ""; |
|
49 #else |
|
50 static const wchar_t *_empty_wstr = L""; |
|
51 #endif |
|
52 #endif |
|
53 |
|
54 static _Locale_mask_t ctable[256]; |
|
55 |
|
56 /* Framework functions */ |
|
57 |
|
58 void _Locale_init(void) { |
|
59 /* Ctype table for the ASCII character set. */ |
|
60 char c; |
|
61 /* We might never reach 128 when char is signed. */ |
|
62 for (c = 0; /* c != 128 */; ++c) { |
|
63 if (isalpha(c)) ctable[(unsigned char)c] |= _Locale_ALPHA; |
|
64 if (iscntrl(c)) ctable[(unsigned char)c] |= _Locale_CNTRL; |
|
65 if (isdigit(c)) ctable[(unsigned char)c] |= _Locale_DIGIT; |
|
66 if (isprint(c)) ctable[(unsigned char)c] |= _Locale_PRINT; |
|
67 if (ispunct(c)) ctable[(unsigned char)c] |= _Locale_PUNCT; |
|
68 if (isspace(c)) ctable[(unsigned char)c] |= _Locale_SPACE; |
|
69 if (isxdigit(c)) ctable[(unsigned char)c] |= _Locale_XDIGIT; |
|
70 if (isupper(c)) ctable[(unsigned char)c] |= _Locale_UPPER; |
|
71 if (islower(c)) ctable[(unsigned char)c] |= _Locale_LOWER; |
|
72 if (c == 127) break; |
|
73 } |
|
74 |
|
75 /* ASCII is a 7-bit code, so everything else is non-ASCII. */ |
|
76 memset(&(ctable[128]), 0, 128 * sizeof(_Locale_mask_t)); |
|
77 } |
|
78 |
|
79 void _Locale_final(void) |
|
80 {} |
|
81 |
|
82 void* _Locale_create(const char* name, int *__err_code) { |
|
83 if (name[0] == 'C' && name[1] == 0) |
|
84 { return (void*)0x1; } |
|
85 *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0; |
|
86 } |
|
87 |
|
88 struct _Locale_ctype* _Locale_ctype_create(const char *name, |
|
89 struct _Locale_name_hint* hint, int *__err_code) |
|
90 { return (struct _Locale_ctype*)_Locale_create(name, __err_code); } |
|
91 |
|
92 struct _Locale_codecvt* _Locale_codecvt_create(const char *name, |
|
93 struct _Locale_name_hint* hint, int *__err_code) |
|
94 { return (struct _Locale_codecvt*)_Locale_create(name, __err_code); } |
|
95 |
|
96 struct _Locale_numeric* _Locale_numeric_create(const char *name, |
|
97 struct _Locale_name_hint* hint, int *__err_code) |
|
98 { return (struct _Locale_numeric*)_Locale_create(name, __err_code); } |
|
99 |
|
100 struct _Locale_time* _Locale_time_create(const char *name, |
|
101 struct _Locale_name_hint* hint, int *__err_code) |
|
102 { return (struct _Locale_time*)_Locale_create(name, __err_code); } |
|
103 |
|
104 struct _Locale_collate* _Locale_collate_create(const char *name, |
|
105 struct _Locale_name_hint* hint, int *__err_code) |
|
106 { return (struct _Locale_collate*)_Locale_create(name, __err_code); } |
|
107 |
|
108 struct _Locale_monetary* _Locale_monetary_create(const char *name, |
|
109 struct _Locale_name_hint* hint, int *__err_code) |
|
110 { return (struct _Locale_monetary*)_Locale_create(name, __err_code); } |
|
111 |
|
112 struct _Locale_messages* _Locale_messages_create(const char *name, |
|
113 struct _Locale_name_hint* hint, int *__err_code) |
|
114 { return (struct _Locale_messages*)_Locale_create(name, __err_code); } |
|
115 |
|
116 const char *_Locale_ctype_default(char* buf) { return _C_name; } |
|
117 const char *_Locale_numeric_default(char * buf) { return _C_name; } |
|
118 const char *_Locale_time_default(char* buf) { return _C_name; } |
|
119 const char *_Locale_collate_default(char* buf) { return _C_name; } |
|
120 const char *_Locale_monetary_default(char* buf) { return _C_name; } |
|
121 const char *_Locale_messages_default(char* buf) { return _C_name; } |
|
122 |
|
123 char const* _Locale_ctype_name(const struct _Locale_ctype *lctype, char* buf) |
|
124 { return _C_name; } |
|
125 |
|
126 char const* _Locale_codecvt_name(const struct _Locale_codecvt *lcodecvt, char* buf) |
|
127 { return _C_name; } |
|
128 |
|
129 char const* _Locale_numeric_name(const struct _Locale_numeric *lnum, char* buf) |
|
130 { return _C_name; } |
|
131 |
|
132 char const* _Locale_time_name(const struct _Locale_time *ltime, char* buf) |
|
133 { return _C_name; } |
|
134 |
|
135 char const* _Locale_collate_name(const struct _Locale_collate *lcol, char* buf) |
|
136 { return _C_name; } |
|
137 |
|
138 char const* _Locale_monetary_name(const struct _Locale_monetary *lmon, char* buf) |
|
139 { return _C_name; } |
|
140 |
|
141 char const* _Locale_messages_name(const struct _Locale_messages *lmes, char* buf) |
|
142 { return _C_name; } |
|
143 |
|
144 void _Locale_ctype_destroy(struct _Locale_ctype *lctype) {} |
|
145 void _Locale_codecvt_destroy(struct _Locale_codecvt *lcodecvt) {} |
|
146 void _Locale_numeric_destroy(struct _Locale_numeric *lnum) {} |
|
147 void _Locale_time_destroy(struct _Locale_time *ltime) {} |
|
148 void _Locale_collate_destroy(struct _Locale_collate *lcol) {} |
|
149 void _Locale_monetary_destroy(struct _Locale_monetary *lmon) {} |
|
150 void _Locale_messages_destroy(struct _Locale_messages *lmes) {} |
|
151 |
|
152 static char const* _Locale_extract_name(const char* name, int *__err_code) { |
|
153 // When the request is the default locale or the "C" locale we answer "C". |
|
154 if (name[0] == 0 || |
|
155 (name[0] == 'C' && name[1] == 0)) |
|
156 { return _C_name; } |
|
157 *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0; |
|
158 } |
|
159 |
|
160 char const* _Locale_extract_ctype_name(const char *name, char *buf, |
|
161 struct _Locale_name_hint* hint, int *__err_code) |
|
162 { return _Locale_extract_name(name, __err_code); } |
|
163 |
|
164 char const* _Locale_extract_numeric_name(const char *name, char *buf, |
|
165 struct _Locale_name_hint* hint, int *__err_code) |
|
166 { return _Locale_extract_name(name, __err_code); } |
|
167 |
|
168 char const* _Locale_extract_time_name(const char*name, char *buf, |
|
169 struct _Locale_name_hint* hint, int *__err_code) |
|
170 { return _Locale_extract_name(name, __err_code); } |
|
171 |
|
172 char const* _Locale_extract_collate_name(const char *name, char *buf, |
|
173 struct _Locale_name_hint* hint, int *__err_code) |
|
174 { return _Locale_extract_name(name, __err_code); } |
|
175 |
|
176 char const* _Locale_extract_monetary_name(const char *name, char *buf, |
|
177 struct _Locale_name_hint* hint, int *__err_code) |
|
178 { return _Locale_extract_name(name, __err_code); } |
|
179 |
|
180 char const* _Locale_extract_messages_name(const char *name, char *buf, |
|
181 struct _Locale_name_hint* hint, int *__err_code) |
|
182 { return _Locale_extract_name(name, __err_code); } |
|
183 |
|
184 struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype) |
|
185 { return 0; } |
|
186 struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric) |
|
187 { return 0; } |
|
188 struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time) |
|
189 { return 0; } |
|
190 struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate) |
|
191 { return 0; } |
|
192 struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary) |
|
193 { return 0; } |
|
194 struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages) |
|
195 { return 0; } |
|
196 |
|
197 /* ctype */ |
|
198 const _Locale_mask_t* _Locale_ctype_table(struct _Locale_ctype* lctype) { |
|
199 _STLP_MARK_PARAMETER_AS_UNUSED(lctype) |
|
200 return ctable; |
|
201 } |
|
202 |
|
203 int _Locale_toupper(struct _Locale_ctype*lctype, int c) |
|
204 { return toupper(c); } |
|
205 |
|
206 int _Locale_tolower(struct _Locale_ctype*lctype, int c) |
|
207 { return tolower(c); } |
|
208 |
|
209 #ifndef _STLP_NO_WCHAR_T |
|
210 _Locale_mask_t _WLocale_ctype(struct _Locale_ctype *lctype, wint_t wc, _Locale_mask_t mask) { |
|
211 _Locale_mask_t ret = 0; |
|
212 if ((mask & _Locale_ALPHA) != 0 && iswalpha(wc)) |
|
213 ret |= _Locale_ALPHA; |
|
214 |
|
215 if ((mask & _Locale_CNTRL) != 0 && iswcntrl(wc)) |
|
216 ret |= _Locale_CNTRL; |
|
217 |
|
218 if ((mask & _Locale_DIGIT) != 0 && iswdigit(wc)) |
|
219 ret |= _Locale_DIGIT; |
|
220 |
|
221 if ((mask & _Locale_PRINT) != 0 && iswprint(wc)) |
|
222 ret |= _Locale_PRINT; |
|
223 |
|
224 if ((mask & _Locale_PUNCT) != 0 && iswpunct(wc)) |
|
225 ret |= _Locale_PUNCT; |
|
226 |
|
227 if ((mask & _Locale_SPACE) != 0 && iswspace(wc)) |
|
228 ret |= _Locale_SPACE; |
|
229 |
|
230 if ((mask & _Locale_XDIGIT) != 0 && iswxdigit(wc)) |
|
231 ret |= _Locale_XDIGIT; |
|
232 |
|
233 if ((mask & _Locale_UPPER) != 0 && iswupper(wc)) |
|
234 ret |= _Locale_UPPER; |
|
235 |
|
236 if ((mask & _Locale_LOWER) != 0 && iswlower(wc)) |
|
237 ret |= _Locale_LOWER; |
|
238 |
|
239 return ret; |
|
240 } |
|
241 |
|
242 wint_t _WLocale_tolower(struct _Locale_ctype *lctype, wint_t wc) |
|
243 { return towlower(wc); } |
|
244 |
|
245 wint_t _WLocale_toupper(struct _Locale_ctype *lctype, wint_t wc) |
|
246 { return towupper(wc); } |
|
247 |
|
248 int _WLocale_mb_cur_max (struct _Locale_codecvt *lcodecvt) { return 1; } |
|
249 int _WLocale_mb_cur_min (struct _Locale_codecvt *lcodecvt) { return 1; } |
|
250 int _WLocale_is_stateless (struct _Locale_codecvt *lcodecvt) { return 1; } |
|
251 |
|
252 size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt, |
|
253 wchar_t *to, |
|
254 const char *from, size_t n, |
|
255 mbstate_t *st) |
|
256 { *to = *from; return 1; } |
|
257 |
|
258 size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt, |
|
259 char *to, size_t n, |
|
260 const wchar_t c, |
|
261 mbstate_t *st) |
|
262 { *to = (char)c; return 1; } |
|
263 |
|
264 size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt, |
|
265 mbstate_t *st, |
|
266 char *buf, size_t n, char ** next) |
|
267 { *next = buf; return 0; } |
|
268 #endif |
|
269 |
|
270 /* Collate */ |
|
271 int _Locale_strcmp(struct _Locale_collate* lcol, |
|
272 const char* s1, size_t n1, const char* s2, size_t n2) { |
|
273 int ret = 0; |
|
274 char buf1[64], buf2[64]; |
|
275 while (n1 > 0 || n2 > 0) { |
|
276 size_t bufsize1 = n1 < 63 ? n1 : 63; |
|
277 size_t bufsize2 = n2 < 63 ? n2 : 63; |
|
278 _STLP_STRNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0; |
|
279 _STLP_STRNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0; |
|
280 |
|
281 ret = strcmp(buf1, buf2); |
|
282 if (ret != 0) return ret < 0 ? -1 : 1; |
|
283 s1 += bufsize1; n1 -= bufsize1; |
|
284 s2 += bufsize2; n2 -= bufsize2; |
|
285 } |
|
286 return ret == 0 ? 0 : (ret < 0 ? -1 : 1); |
|
287 } |
|
288 |
|
289 #ifndef _STLP_NO_WCHAR_T |
|
290 |
|
291 int _WLocale_strcmp(struct _Locale_collate* lcol, |
|
292 const wchar_t* s1, size_t n1, const wchar_t* s2, size_t n2) { |
|
293 int ret = 0; |
|
294 wchar_t buf1[64], buf2[64]; |
|
295 while (n1 > 0 || n2 > 0) { |
|
296 size_t bufsize1 = n1 < 63 ? n1 : 63; |
|
297 size_t bufsize2 = n2 < 63 ? n2 : 63; |
|
298 _STLP_WCSNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0; |
|
299 _STLP_WCSNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0; |
|
300 |
|
301 ret = wcscmp(buf1, buf2); |
|
302 if (ret != 0) return ret < 0 ? -1 : 1; |
|
303 s1 += bufsize1; n1 -= bufsize1; |
|
304 s2 += bufsize2; n2 -= bufsize2; |
|
305 } |
|
306 return ret == 0 ? 0 : (ret < 0 ? -1 : 1); |
|
307 } |
|
308 |
|
309 #endif |
|
310 |
|
311 size_t _Locale_strxfrm(struct _Locale_collate* lcol, |
|
312 char* dest, size_t dest_n, |
|
313 const char* src, size_t src_n) { |
|
314 if (dest != 0) { |
|
315 _STLP_STRNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0; |
|
316 } |
|
317 return src_n; |
|
318 } |
|
319 |
|
320 #ifndef _STLP_NO_WCHAR_T |
|
321 |
|
322 size_t _WLocale_strxfrm(struct _Locale_collate* lcol, |
|
323 wchar_t* dest, size_t dest_n, |
|
324 const wchar_t* src, size_t src_n) { |
|
325 if (dest != 0) { |
|
326 _STLP_WCSNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0; |
|
327 } |
|
328 return src_n; |
|
329 } |
|
330 |
|
331 #endif |
|
332 |
|
333 /* Numeric */ |
|
334 |
|
335 char _Locale_decimal_point(struct _Locale_numeric* lnum) |
|
336 { return '.'; } |
|
337 char _Locale_thousands_sep(struct _Locale_numeric* lnum) |
|
338 { return ','; } |
|
339 const char* _Locale_grouping(struct _Locale_numeric * lnum) |
|
340 { return _empty_str; } |
|
341 const char * _Locale_true(struct _Locale_numeric * lnum) |
|
342 { return "true"; } |
|
343 const char * _Locale_false(struct _Locale_numeric * lnum) |
|
344 { return "false"; } |
|
345 |
|
346 #ifndef _STLP_NO_WCHAR_T |
|
347 wchar_t _WLocale_decimal_point(struct _Locale_numeric* lnum) |
|
348 { return L'.'; } |
|
349 wchar_t _WLocale_thousands_sep(struct _Locale_numeric* lnum) |
|
350 { return L','; } |
|
351 #if defined(WCHAR_MAX) && WCHAR_MAX == 255 |
|
352 const wchar_t * _WLocale_true(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize) |
|
353 { return "true"; } |
|
354 const wchar_t * _WLocale_false(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize) |
|
355 { return "false"; } |
|
356 #else |
|
357 const wchar_t * _WLocale_true(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize) |
|
358 { return L"true"; } |
|
359 const wchar_t * _WLocale_false(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize) |
|
360 { return L"false"; } |
|
361 #endif |
|
362 #endif |
|
363 |
|
364 /* Monetary */ |
|
365 |
|
366 const char* _Locale_int_curr_symbol(struct _Locale_monetary * lmon) |
|
367 { return _empty_str; } |
|
368 const char* _Locale_currency_symbol(struct _Locale_monetary * lmon) |
|
369 { return _empty_str; } |
|
370 char _Locale_mon_decimal_point(struct _Locale_monetary * lmon) |
|
371 { return '.'; } |
|
372 char _Locale_mon_thousands_sep(struct _Locale_monetary * lmon) |
|
373 { return ','; } |
|
374 const char* _Locale_mon_grouping(struct _Locale_monetary * lmon) |
|
375 { return _empty_str; } |
|
376 const char* _Locale_positive_sign(struct _Locale_monetary * lmon) |
|
377 { return _empty_str; } |
|
378 const char* _Locale_negative_sign(struct _Locale_monetary * lmon) |
|
379 { return _empty_str; } |
|
380 char _Locale_int_frac_digits(struct _Locale_monetary * lmon) |
|
381 { return 0; } |
|
382 char _Locale_frac_digits(struct _Locale_monetary * lmon) |
|
383 { return 0; } |
|
384 int _Locale_p_cs_precedes(struct _Locale_monetary * lmon) |
|
385 { return CHAR_MAX; } |
|
386 int _Locale_p_sep_by_space(struct _Locale_monetary * lmon) |
|
387 { return CHAR_MAX; } |
|
388 int _Locale_p_sign_posn(struct _Locale_monetary * lmon) |
|
389 { return CHAR_MAX; } |
|
390 int _Locale_n_cs_precedes(struct _Locale_monetary * lmon) |
|
391 { return CHAR_MAX; } |
|
392 int _Locale_n_sep_by_space(struct _Locale_monetary * lmon) |
|
393 { return CHAR_MAX; } |
|
394 int _Locale_n_sign_posn(struct _Locale_monetary * lmon) |
|
395 { return CHAR_MAX; } |
|
396 |
|
397 #ifndef _STLP_NO_WCHAR_T |
|
398 const wchar_t* _WLocale_int_curr_symbol(struct _Locale_monetary * lmon, |
|
399 wchar_t* buf, size_t bufSize) |
|
400 { return _empty_wstr; } |
|
401 const wchar_t* _WLocale_currency_symbol(struct _Locale_monetary * lmon, |
|
402 wchar_t* buf, size_t bufSize) |
|
403 { return _empty_wstr; } |
|
404 wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary * lmon) |
|
405 { return L'.'; } |
|
406 wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary * lmon) |
|
407 { return L','; } |
|
408 const wchar_t* _WLocale_positive_sign(struct _Locale_monetary * lmon, |
|
409 wchar_t* buf, size_t bufSize) |
|
410 { return _empty_wstr; } |
|
411 const wchar_t* _WLocale_negative_sign(struct _Locale_monetary * lmon, |
|
412 wchar_t* buf, size_t bufSize) |
|
413 { return _empty_wstr; } |
|
414 #endif |
|
415 |
|
416 /* Time */ |
|
417 static const char* full_monthname[] = |
|
418 { "January", "February", "March", "April", "May", "June", |
|
419 "July", "August", "September", "October", "November", "December" }; |
|
420 const char * _Locale_full_monthname(struct _Locale_time * ltime, int n) |
|
421 { return full_monthname[n]; } |
|
422 |
|
423 static const char* abbrev_monthname[] = |
|
424 { "Jan", "Feb", "Mar", "Apr", "May", "Jun", |
|
425 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; |
|
426 const char * _Locale_abbrev_monthname(struct _Locale_time * ltime, int n) |
|
427 { return abbrev_monthname[n]; } |
|
428 |
|
429 static const char* full_dayname[] = |
|
430 { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; |
|
431 const char * _Locale_full_dayofweek(struct _Locale_time * ltime, int n) |
|
432 { return full_dayname[n]; } |
|
433 |
|
434 static const char* abbrev_dayname[] = |
|
435 { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; |
|
436 const char * _Locale_abbrev_dayofweek(struct _Locale_time * ltime, int n) |
|
437 { return abbrev_dayname[n]; } |
|
438 |
|
439 const char* _Locale_d_t_fmt(struct _Locale_time* ltime) |
|
440 { return "%m/%d/%y"; } |
|
441 const char* _Locale_d_fmt(struct _Locale_time* ltime) |
|
442 { return "%m/%d/%y"; } |
|
443 const char* _Locale_t_fmt(struct _Locale_time* ltime) |
|
444 { return "%H:%M:%S"; } |
|
445 const char* _Locale_long_d_t_fmt(struct _Locale_time* ltime) |
|
446 { return _empty_str; } |
|
447 const char* _Locale_long_d_fmt(struct _Locale_time* ltime) |
|
448 { return _empty_str; } |
|
449 const char* _Locale_am_str(struct _Locale_time* ltime) |
|
450 { return "AM"; } |
|
451 const char* _Locale_pm_str(struct _Locale_time* ltime) |
|
452 { return "PM"; } |
|
453 |
|
454 #ifndef _STLP_NO_WCHAR_T |
|
455 #if defined(WCHAR_MAX) && WCHAR_MAX == 255 |
|
456 static const wchar_t* full_wmonthname[] = |
|
457 { "January", "February", "March", "April", "May", "June", |
|
458 "July", "August", "September", "October", "November", "December" }; |
|
459 const wchar_t * _WLocale_full_monthname(struct _Locale_time * ltime, int n, |
|
460 wchar_t* buf, size_t bufSize) |
|
461 { return full_wmonthname[n]; } |
|
462 |
|
463 static const wchar_t* abbrev_wmonthname[] = |
|
464 { "Jan", "Feb", "Mar", "Apr", "May", "Jun", |
|
465 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; |
|
466 const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time * ltime, int n, |
|
467 wchar_t* buf, size_t bufSize) |
|
468 { return abbrev_wmonthname[n]; } |
|
469 |
|
470 static const wchar_t* full_wdayname[] = |
|
471 { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; |
|
472 const wchar_t * _WLocale_full_dayofweek(struct _Locale_time * ltime, int n, |
|
473 wchar_t* buf, size_t bufSize) |
|
474 { return full_wdayname[n]; } |
|
475 |
|
476 static const wchar_t* abbrev_wdayname[] = |
|
477 { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; |
|
478 const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time * ltime, int n, |
|
479 wchar_t* buf, size_t bufSize) |
|
480 { return abbrev_wdayname[n]; } |
|
481 |
|
482 const wchar_t* _WLocale_am_str(struct _Locale_time* ltime, |
|
483 wchar_t* buf, size_t bufSize) |
|
484 { return "AM"; } |
|
485 const wchar_t* _WLocale_pm_str(struct _Locale_time* ltime, |
|
486 wchar_t* buf, size_t bufSize) |
|
487 { return "PM"; } |
|
488 #else /* WCHAR_MAX != 255 */ |
|
489 static const wchar_t* full_wmonthname[] = |
|
490 { L"January", L"February", L"March", L"April", L"May", L"June", |
|
491 L"July", L"August", L"September", L"October", L"November", L"December" }; |
|
492 const wchar_t * _WLocale_full_monthname(struct _Locale_time * ltime, int n, |
|
493 wchar_t* buf, size_t bufSize) |
|
494 { return full_wmonthname[n]; } |
|
495 |
|
496 static const wchar_t* abbrev_wmonthname[] = |
|
497 { L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun", |
|
498 L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec" }; |
|
499 const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time * ltime, int n, |
|
500 wchar_t* buf, size_t bufSize) |
|
501 { return abbrev_wmonthname[n]; } |
|
502 |
|
503 static const wchar_t* full_wdayname[] = |
|
504 { L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday", L"Friday", L"Saturday" }; |
|
505 const wchar_t * _WLocale_full_dayofweek(struct _Locale_time * ltime, int n, |
|
506 wchar_t* buf, size_t bufSize) |
|
507 { return full_wdayname[n]; } |
|
508 |
|
509 static const wchar_t* abbrev_wdayname[] = |
|
510 { L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat" }; |
|
511 const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time * ltime, int n, |
|
512 wchar_t* buf, size_t bufSize) |
|
513 { return abbrev_wdayname[n]; } |
|
514 |
|
515 const wchar_t* _WLocale_am_str(struct _Locale_time* ltime, |
|
516 wchar_t* buf, size_t bufSize) |
|
517 { return L"AM"; } |
|
518 const wchar_t* _WLocale_pm_str(struct _Locale_time* ltime, |
|
519 wchar_t* buf, size_t bufSize) |
|
520 { return L"PM"; } |
|
521 #endif /* WCHAR_MAX != 255 */ |
|
522 #endif |
|
523 |
|
524 /* Messages */ |
|
525 |
|
526 nl_catd_type _Locale_catopen(struct _Locale_messages* lmes, const char* name) |
|
527 { return -1; } |
|
528 void _Locale_catclose(struct _Locale_messages* lmes, nl_catd_type cat) {} |
|
529 const char* _Locale_catgets(struct _Locale_messages* lmes, nl_catd_type cat, |
|
530 int setid, int msgid, const char *dfault) |
|
531 { return dfault; } |