Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenc_locale_glibc2.c
Go to the documentation of this file.
00001 #include <locale.h> 00002 #include <langinfo.h> 00003 #include <stdio.h> 00004 #include <stdlib.h> 00005 #include <wctype.h> 00006 #include <string.h> 00007 #include <stdint.h> 00008 00009 static const char *_empty_str = ""; 00010 static const char *_C_name = "C"; 00011 00012 static wchar_t* _ToWChar(const char* buf, wchar_t *wbuf, size_t wbufSize) { 00013 wchar_t *wcur = wbuf; 00014 wchar_t *wend = wbuf + wbufSize - 1; 00015 for (; wcur != wend && *buf != 0; ++buf, ++wcur) 00016 *wcur = *buf; 00017 *wcur = 0; 00018 return wbuf; 00019 } 00020 00021 #if 0 00022 struct _Locale_ctype 00023 { 00024 locale_t __cloc; 00025 }; 00026 00027 struct _Locale_numeric 00028 { 00029 locale_t __cloc; 00030 }; 00031 00032 struct _Locale_time 00033 { 00034 locale_t __cloc; 00035 }; 00036 00037 struct _Locale_collate 00038 { 00039 locale_t __cloc; 00040 }; 00041 00042 struct _Locale_monetary 00043 { 00044 locale_t __cloc; 00045 }; 00046 00047 struct _Locale_messages 00048 { 00049 locale_t __cloc; 00050 }; 00051 #endif 00052 00053 void _Locale_init() 00054 {} 00055 00056 void _Locale_final() 00057 {} 00058 00059 struct _Locale_ctype *_Locale_ctype_create(const char *nm, struct _Locale_name_hint* hint, 00060 int *__err_code) { 00061 *__err_code = _STLP_LOC_UNKNOWN_NAME; 00062 return (struct _Locale_ctype*)newlocale(LC_CTYPE_MASK, nm, NULL); 00063 } 00064 00065 struct _Locale_codecvt *_Locale_codecvt_create(const char *nm, struct _Locale_name_hint* hint, 00066 int *__err_code) { 00067 // Glibc do not support multibyte manipulation for the moment, it simply implements "C". 00068 if (nm[0] == 'C' && nm[1] == 0) 00069 { return (struct _Locale_codecvt*)0x01; } 00070 *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0; 00071 } 00072 00073 struct _Locale_numeric *_Locale_numeric_create(const char *nm, struct _Locale_name_hint* hint, 00074 int *__err_code) { 00075 *__err_code = _STLP_LOC_UNKNOWN_NAME; 00076 return (struct _Locale_numeric*)newlocale(LC_NUMERIC_MASK, nm, NULL); 00077 } 00078 00079 struct _Locale_time *_Locale_time_create(const char *nm, struct _Locale_name_hint* hint, 00080 int *__err_code) { 00081 *__err_code = _STLP_LOC_UNKNOWN_NAME; 00082 return (struct _Locale_time*)newlocale(LC_TIME_MASK, nm, NULL); 00083 } 00084 00085 struct _Locale_collate *_Locale_collate_create(const char *nm, struct _Locale_name_hint* hint, 00086 int *__err_code) { 00087 *__err_code = _STLP_LOC_UNKNOWN_NAME; 00088 return (struct _Locale_collate*)newlocale(LC_COLLATE_MASK, nm, NULL); 00089 } 00090 00091 struct _Locale_monetary *_Locale_monetary_create(const char *nm, struct _Locale_name_hint* hint, 00092 int *__err_code) { 00093 *__err_code = _STLP_LOC_UNKNOWN_NAME; 00094 return (struct _Locale_monetary*)newlocale(LC_MONETARY_MASK, nm, NULL); 00095 } 00096 00097 struct _Locale_messages *_Locale_messages_create(const char *nm, struct _Locale_name_hint* hint, 00098 int *__err_code) { 00099 *__err_code = _STLP_LOC_UNKNOWN_NAME; 00100 return (struct _Locale_messages*)newlocale(LC_MESSAGES_MASK, nm, NULL); 00101 } 00102 00103 /* 00104 try to see locale category LC should be used from environment; 00105 according POSIX, the order is 00106 1. LC_ALL 00107 2. category (LC_CTYPE, LC_NUMERIC, ... ) 00108 3. LANG 00109 If set nothing, return "C" (this really implementation-specific). 00110 */ 00111 static const char *_Locale_aux_default( const char *LC, char *nm ) 00112 { 00113 char *name = getenv( "LC_ALL" ); 00114 00115 if ( name != NULL && *name != 0 ) { 00116 return name; 00117 } 00118 name = getenv( LC ); 00119 if ( name != NULL && *name != 0 ) { 00120 return name; 00121 } 00122 name = getenv( "LANG" ); 00123 if ( name != NULL && *name != 0 ) { 00124 return name; 00125 } 00126 00127 return _C_name; 00128 } 00129 00130 const char *_Locale_ctype_default( char *nm ) 00131 { 00132 return _Locale_aux_default( "LC_CTYPE", nm ); 00133 } 00134 00135 const char *_Locale_numeric_default( char *nm ) 00136 { 00137 return _Locale_aux_default( "LC_NUMERIC", nm ); 00138 } 00139 00140 const char *_Locale_time_default( char *nm ) 00141 { 00142 return _Locale_aux_default( "LC_TIME", nm ); 00143 } 00144 00145 const char *_Locale_collate_default( char *nm ) 00146 { 00147 return _Locale_aux_default( "LC_COLLATE", nm ); 00148 } 00149 00150 const char *_Locale_monetary_default( char *nm ) 00151 { 00152 return _Locale_aux_default( "LC_MONETARY", nm ); 00153 } 00154 00155 const char *_Locale_messages_default( char *nm ) 00156 { 00157 return _Locale_aux_default( "LC_MESSAGES", nm ); 00158 } 00159 00160 char const*_Locale_ctype_name( const struct _Locale_ctype *__loc, char *buf ) 00161 { 00162 return ((locale_t)__loc)->__names[LC_CTYPE]; 00163 } 00164 00165 char const*_Locale_codecvt_name( const struct _Locale_codecvt *__loc, char *buf ) 00166 { 00167 return _C_name; 00168 } 00169 00170 char const*_Locale_numeric_name( const struct _Locale_numeric *__loc, char *buf ) 00171 { 00172 return ((locale_t)__loc)->__names[LC_NUMERIC]; 00173 } 00174 00175 char const*_Locale_time_name( const struct _Locale_time *__loc, char *buf ) 00176 { 00177 return ((locale_t)__loc)->__names[LC_TIME]; 00178 } 00179 00180 char const*_Locale_collate_name( const struct _Locale_collate *__loc, char *buf ) 00181 { 00182 return ((locale_t)__loc)->__names[LC_COLLATE]; 00183 } 00184 00185 char const*_Locale_monetary_name( const struct _Locale_monetary *__loc, char *buf ) 00186 { 00187 return ((locale_t)__loc)->__names[LC_MONETARY]; 00188 } 00189 00190 char const*_Locale_messages_name( const struct _Locale_messages *__loc, char *buf ) 00191 { 00192 return ((locale_t)__loc)->__names[LC_MESSAGES]; 00193 } 00194 00195 void _Locale_ctype_destroy( struct _Locale_ctype *__loc ) 00196 { freelocale((locale_t)__loc); } 00197 00198 void _Locale_codecvt_destroy( struct _Locale_codecvt *__loc ) 00199 {} 00200 00201 void _Locale_numeric_destroy( struct _Locale_numeric *__loc ) 00202 { freelocale((locale_t)__loc); } 00203 00204 void _Locale_time_destroy( struct _Locale_time *__loc ) 00205 { freelocale((locale_t)__loc); } 00206 00207 void _Locale_collate_destroy( struct _Locale_collate *__loc ) 00208 { freelocale((locale_t)__loc); } 00209 00210 void _Locale_monetary_destroy( struct _Locale_monetary *__loc ) 00211 { freelocale((locale_t)__loc); } 00212 00213 void _Locale_messages_destroy( struct _Locale_messages* __loc ) 00214 { freelocale((locale_t)__loc); } 00215 00216 /* 00217 * locale loc expected either locale name indeed (platform-specific) 00218 * or string like "LC_CTYPE=LocaleNameForCType;LC_NUMERIC=LocaleNameForNum;" 00219 * 00220 */ 00221 00222 static char const*__Extract_locale_name( const char *loc, const char *category, char *buf ) 00223 { 00224 char *expr; 00225 size_t len_name; 00226 00227 if( loc[0]=='L' && loc[1]=='C' && loc[2]=='_') { 00228 expr = strstr( (char*)loc, category ); 00229 if ( expr == NULL ) 00230 return NULL; /* Category not found. */ 00231 ++expr; 00232 len_name = strcspn( expr, ";" ); 00233 len_name = len_name >= _Locale_MAX_SIMPLE_NAME ? _Locale_MAX_SIMPLE_NAME - 1 : len_name; 00234 strncpy( buf, expr, len_name ); 00235 buf[len_name] = 0; 00236 return buf; 00237 } 00238 return loc; 00239 } 00240 00241 char const*_Locale_extract_ctype_name(const char *loc, char *buf, 00242 struct _Locale_name_hint* hint, int *__err_code) 00243 { return __Extract_locale_name( loc, "LC_CTYPE=", buf ); } 00244 00245 char const*_Locale_extract_numeric_name(const char *loc, char *buf, 00246 struct _Locale_name_hint* hint, int *__err_code) 00247 { return __Extract_locale_name( loc, "LC_NUMERIC=", buf ); } 00248 00249 char const*_Locale_extract_time_name(const char *loc, char *buf, 00250 struct _Locale_name_hint* hint, int *__err_code) 00251 { return __Extract_locale_name( loc, "LC_TIME=", buf ); } 00252 00253 char const*_Locale_extract_collate_name(const char *loc, char *buf, 00254 struct _Locale_name_hint* hint, int *__err_code) 00255 { return __Extract_locale_name( loc, "LC_COLLATE=", buf ); } 00256 00257 char const*_Locale_extract_monetary_name(const char *loc, char *buf, 00258 struct _Locale_name_hint* hint, int *__err_code) 00259 { return __Extract_locale_name( loc, "LC_MONETARY=", buf ); } 00260 00261 char const*_Locale_extract_messages_name(const char *loc, char *buf, 00262 struct _Locale_name_hint* hint, int *__err_code) 00263 { return __Extract_locale_name( loc, "LC_MESSAGES=", buf ); } 00264 00265 struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype) 00266 { return 0; } 00267 struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric) 00268 { return 0; } 00269 struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time) 00270 { return 0; } 00271 struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate) 00272 { return 0; } 00273 struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary) 00274 { return 0; } 00275 struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages) 00276 { return 0; } 00277 00278 /* ctype */ 00279 00280 const _Locale_mask_t *_Locale_ctype_table( struct _Locale_ctype *__loc ) 00281 { 00282 /* return table with masks (upper, lower, alpha, etc.) */ 00283 _STLP_STATIC_ASSERT( sizeof(_Locale_mask_t) == sizeof(((locale_t)__loc)->__ctype_b[0]) ) 00284 return ((locale_t)__loc)->__ctype_b; 00285 } 00286 00287 int _Locale_toupper( struct _Locale_ctype *__loc, int c ) 00288 { return ((locale_t)__loc)->__ctype_toupper[c]; } 00289 00290 int _Locale_tolower( struct _Locale_ctype *__loc, int c ) 00291 { return ((locale_t)__loc)->__ctype_tolower[c]; } 00292 00293 #if !defined (_STLP_NO_WCHAR_T) 00294 _Locale_mask_t _WLocale_ctype( struct _Locale_ctype *__loc, wint_t wc, _Locale_mask_t __mask ) 00295 { 00296 _Locale_mask_t ret = 0; 00297 if ((__mask & _Locale_ALPHA) != 0 && iswalpha_l(wc, (locale_t)__loc)) 00298 ret |= _Locale_ALPHA; 00299 00300 if ((__mask & _Locale_CNTRL) != 0 && iswcntrl_l(wc, (locale_t)__loc)) 00301 ret |= _Locale_CNTRL; 00302 00303 if ((__mask & _Locale_DIGIT) != 0 && iswdigit_l(wc, (locale_t)__loc)) 00304 ret |= _Locale_DIGIT; 00305 00306 if ((__mask & _Locale_PRINT) != 0 && iswprint_l(wc, (locale_t)__loc)) 00307 ret |= _Locale_PRINT; 00308 00309 if ((__mask & _Locale_PUNCT) != 0 && iswpunct_l(wc, (locale_t)__loc)) 00310 ret |= _Locale_PUNCT; 00311 00312 if ((__mask & _Locale_SPACE) != 0 && iswspace_l(wc, (locale_t)__loc)) 00313 ret |= _Locale_SPACE; 00314 00315 if ((__mask & _Locale_XDIGIT) != 0 && iswxdigit_l(wc, (locale_t)__loc)) 00316 ret |= _Locale_XDIGIT; 00317 00318 if ((__mask & _Locale_UPPER) != 0 && iswupper_l(wc, (locale_t)__loc)) 00319 ret |= _Locale_UPPER; 00320 00321 if ((__mask & _Locale_LOWER) != 0 && iswlower_l(wc, (locale_t)__loc)) 00322 ret |= _Locale_LOWER; 00323 00324 return ret; 00325 } 00326 00327 wint_t _WLocale_tolower( struct _Locale_ctype *__loc, wint_t c ) 00328 { 00329 return towlower_l( c, ((locale_t)__loc) ); 00330 } 00331 00332 wint_t _WLocale_toupper( struct _Locale_ctype *__loc, wint_t c ) 00333 { 00334 return towupper_l( c, ((locale_t)__loc) ); 00335 } 00336 #endif 00337 00338 int _WLocale_mb_cur_max( struct _Locale_codecvt * lcodecvt) { return 1; } 00339 int _WLocale_mb_cur_min( struct _Locale_codecvt * lcodecvt) { return 1; } 00340 int _WLocale_is_stateless( struct _Locale_codecvt * lcodecvt) { return 1; } 00341 00342 #if !defined (_STLP_NO_WCHAR_T) 00343 size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt, 00344 wchar_t *to, 00345 const char *from, size_t n, 00346 mbstate_t *st) 00347 { *to = *from; return 1; } 00348 00349 size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt, 00350 char *to, size_t n, 00351 const wchar_t c, 00352 mbstate_t *st) 00353 { *to = (char)c; return 1; } 00354 #endif 00355 00356 size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt, 00357 mbstate_t *st, 00358 char *buf, size_t n, char ** next) 00359 { *next = buf; return 0; } 00360 00361 /* Collate */ 00362 int _Locale_strcmp(struct _Locale_collate * __loc, 00363 const char *s1, size_t n1, 00364 const char *s2, size_t n2) { 00365 int ret = 0; 00366 char buf1[64], buf2[64]; 00367 while (n1 > 0 || n2 > 0) { 00368 size_t bufsize1 = n1 < 63 ? n1 : 63; 00369 size_t bufsize2 = n2 < 63 ? n2 : 63; 00370 strncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0; 00371 strncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0; 00372 00373 ret = strcoll_l(buf1, buf2, (locale_t)__loc); 00374 if (ret != 0) return ret; 00375 s1 += bufsize1; n1 -= bufsize1; 00376 s2 += bufsize2; n2 -= bufsize2; 00377 } 00378 return ret; 00379 } 00380 00381 #if !defined (_STLP_NO_WCHAR_T) 00382 int _WLocale_strcmp(struct _Locale_collate *__loc, 00383 const wchar_t *s1, size_t n1, 00384 const wchar_t *s2, size_t n2) { 00385 int ret = 0; 00386 wchar_t buf1[64], buf2[64]; 00387 while (n1 > 0 || n2 > 0) { 00388 size_t bufsize1 = n1 < 63 ? n1 : 63; 00389 size_t bufsize2 = n2 < 63 ? n2 : 63; 00390 wcsncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0; 00391 wcsncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0; 00392 00393 ret = wcscoll_l(buf1, buf2, (locale_t)__loc); 00394 if (ret != 0) return ret; 00395 s1 += bufsize1; n1 -= bufsize1; 00396 s2 += bufsize2; n2 -= bufsize2; 00397 } 00398 return ret; 00399 } 00400 00401 #endif 00402 00403 size_t _Locale_strxfrm(struct _Locale_collate *__loc, 00404 char *dest, size_t dest_n, 00405 const char *src, size_t src_n ) 00406 { 00407 const char *real_src; 00408 char *buf = NULL; 00409 size_t result; 00410 00411 if (src_n == 0) 00412 { 00413 if (dest != NULL) dest[0] = 0; 00414 return 0; 00415 } 00416 if (src[src_n] != 0) { 00417 buf = malloc(src_n + 1); 00418 strncpy(buf, src, src_n); 00419 buf[src_n] = 0; 00420 real_src = buf; 00421 } 00422 else 00423 real_src = src; 00424 result = strxfrm_l(dest, real_src, dest_n, (locale_t)__loc); 00425 if (buf != NULL) free(buf); 00426 return result; 00427 } 00428 00429 # ifndef _STLP_NO_WCHAR_T 00430 00431 size_t _WLocale_strxfrm( struct _Locale_collate *__loc, 00432 wchar_t *dest, size_t dest_n, 00433 const wchar_t *src, size_t src_n ) 00434 { 00435 const wchar_t *real_src; 00436 wchar_t *buf = NULL; 00437 size_t result; 00438 00439 if (src_n == 0) 00440 { 00441 if (dest != NULL) dest[0] = 0; 00442 return 0; 00443 } 00444 if (src[src_n] != 0) { 00445 buf = malloc((src_n + 1) * sizeof(wchar_t)); 00446 wcsncpy(buf, src, src_n); 00447 buf[src_n] = 0; 00448 real_src = buf; 00449 } 00450 else 00451 real_src = src; 00452 result = wcsxfrm_l(dest, real_src, dest_n, (locale_t)__loc); 00453 if (buf != NULL) free(buf); 00454 return result; 00455 } 00456 00457 # endif 00458 00459 /* Numeric */ 00460 00461 char _Locale_decimal_point(struct _Locale_numeric *__loc) 00462 { 00463 return *(nl_langinfo_l(RADIXCHAR, (locale_t)__loc)); 00464 } 00465 00466 char _Locale_thousands_sep(struct _Locale_numeric *__loc) 00467 { 00468 return *(nl_langinfo_l(THOUSEP, (locale_t)__loc)); 00469 } 00470 00471 const char* _Locale_grouping(struct _Locale_numeric *__loc) 00472 { 00473 return (_Locale_thousands_sep(__loc) != 0 ) ? (nl_langinfo_l(GROUPING, (locale_t)__loc)) : _empty_str; 00474 } 00475 00476 const char *_Locale_true(struct _Locale_numeric *__loc) 00477 { 00478 return nl_langinfo_l(YESSTR, (locale_t)__loc); 00479 } 00480 00481 const char *_Locale_false(struct _Locale_numeric *__loc) 00482 { 00483 return nl_langinfo_l(NOSTR, (locale_t)__loc); 00484 } 00485 00486 #ifndef _STLP_NO_WCHAR_T 00487 wchar_t _WLocale_decimal_point(struct _Locale_numeric *__loc) 00488 { return (wchar_t)_Locale_decimal_point(__loc); } 00489 wchar_t _WLocale_thousands_sep(struct _Locale_numeric *__loc) 00490 { return (wchar_t)_Locale_thousands_sep(__loc); } 00491 const wchar_t *_WLocale_true(struct _Locale_numeric *__loc, wchar_t *buf, size_t bufSize) 00492 { return _ToWChar(_Locale_true(__loc), buf, bufSize); } 00493 const wchar_t *_WLocale_false(struct _Locale_numeric *__loc, wchar_t *buf, size_t bufSize) 00494 { return _ToWChar(_Locale_false(__loc), buf, bufSize); } 00495 #endif 00496 00497 /* Monetary */ 00498 00499 const char *_Locale_int_curr_symbol(struct _Locale_monetary *__loc) 00500 { 00501 return nl_langinfo_l(INT_CURR_SYMBOL, (locale_t)__loc); 00502 } 00503 00504 const char *_Locale_currency_symbol(struct _Locale_monetary *__loc) 00505 { 00506 return nl_langinfo_l(CURRENCY_SYMBOL, (locale_t)__loc); 00507 } 00508 00509 char _Locale_mon_decimal_point(struct _Locale_monetary * __loc) 00510 { 00511 return *(nl_langinfo_l(MON_DECIMAL_POINT,(locale_t)__loc)); 00512 } 00513 00514 char _Locale_mon_thousands_sep(struct _Locale_monetary *__loc) 00515 { 00516 return *(nl_langinfo_l(MON_THOUSANDS_SEP, (locale_t)__loc)); 00517 } 00518 00519 #ifndef _STLP_NO_WCHAR_T 00520 const wchar_t *_WLocale_int_curr_symbol(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize) 00521 { return _ToWChar(_Locale_int_curr_symbol(__loc), buf, bufSize); } 00522 const wchar_t *_WLocale_currency_symbol(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize) 00523 { return _ToWChar(_Locale_currency_symbol(__loc), buf, bufSize); } 00524 wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary * __loc) 00525 { return (wchar_t)_Locale_mon_decimal_point(__loc); } 00526 wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary * __loc) 00527 { return (wchar_t)_Locale_mon_thousands_sep(__loc); } 00528 const wchar_t *_WLocale_positive_sign(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize) 00529 { return _ToWChar(_Locale_positive_sign(__loc), buf, bufSize); } 00530 const wchar_t *_WLocale_negative_sign(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize) 00531 { return _ToWChar(_Locale_negative_sign(__loc), buf, bufSize); } 00532 #endif 00533 00534 const char *_Locale_mon_grouping(struct _Locale_monetary *__loc) 00535 { 00536 return (_Locale_mon_thousands_sep( __loc ) != 0 ) ? nl_langinfo_l(MON_GROUPING, (locale_t)__loc) : _empty_str; 00537 } 00538 00539 const char *_Locale_positive_sign(struct _Locale_monetary *__loc) 00540 { 00541 return nl_langinfo_l(POSITIVE_SIGN, (locale_t)__loc); 00542 } 00543 00544 const char *_Locale_negative_sign(struct _Locale_monetary *__loc) 00545 { 00546 return nl_langinfo_l(NEGATIVE_SIGN, (locale_t)__loc); 00547 } 00548 00549 char _Locale_int_frac_digits(struct _Locale_monetary *__loc) 00550 { 00551 /* We are forced to manually handled the "C" locale for consistency with 00552 * the default implementation in STLport. */ 00553 const char* lname = ((locale_t)__loc)->__names[LC_MONETARY]; 00554 if (lname[0] == 'C' && lname[1] == 0) 00555 return 0; 00556 return *(nl_langinfo_l(INT_FRAC_DIGITS, (locale_t)__loc)); 00557 } 00558 00559 char _Locale_frac_digits(struct _Locale_monetary *__loc) 00560 { 00561 /* We are forced to manually handled the "C" locale for consistency with 00562 * the default implementation in STLport. */ 00563 const char* lname = ((locale_t)__loc)->__names[LC_MONETARY]; 00564 if (lname[0] == 'C' && lname[1] == 0) 00565 return 0; 00566 return *(nl_langinfo_l(FRAC_DIGITS, (locale_t)__loc)); 00567 } 00568 00569 /* 1 if currency_symbol precedes a positive value, 0 if succeeds */ 00570 int _Locale_p_cs_precedes(struct _Locale_monetary *__loc) 00571 { 00572 return *(nl_langinfo_l(P_CS_PRECEDES, (locale_t)__loc)); 00573 } 00574 00575 /* 1 if a space separates currency_symbol from a positive value. */ 00576 int _Locale_p_sep_by_space(struct _Locale_monetary *__loc) 00577 { 00578 return *(nl_langinfo_l(P_SEP_BY_SPACE, (locale_t)__loc)); 00579 } 00580 00581 /* 00582 * 0 Parentheses surround the quantity and currency_symbol 00583 * 1 The sign string precedes the quantity and currency_symbol 00584 * 2 The sign string succeeds the quantity and currency_symbol. 00585 * 3 The sign string immediately precedes the currency_symbol. 00586 * 4 The sign string immediately succeeds the currency_symbol. 00587 */ 00588 int _Locale_p_sign_posn(struct _Locale_monetary *__loc) 00589 { 00590 return *(nl_langinfo_l(P_SIGN_POSN, (locale_t)__loc)); 00591 } 00592 00593 /* 1 if currency_symbol precedes a negative value, 0 if succeeds */ 00594 int _Locale_n_cs_precedes(struct _Locale_monetary *__loc) 00595 { 00596 return *(nl_langinfo_l(N_CS_PRECEDES, (locale_t)__loc)); 00597 } 00598 00599 /* 1 if a space separates currency_symbol from a negative value. */ 00600 int _Locale_n_sep_by_space(struct _Locale_monetary *__loc) 00601 { 00602 return *(nl_langinfo_l(N_SEP_BY_SPACE, (locale_t)__loc)); 00603 } 00604 00605 /* 00606 * 0 Parentheses surround the quantity and currency_symbol 00607 * 1 The sign string precedes the quantity and currency_symbol 00608 * 2 The sign string succeeds the quantity and currency_symbol. 00609 * 3 The sign string immediately precedes the currency_symbol. 00610 * 4 The sign string immediately succeeds the currency_symbol. 00611 */ 00612 int _Locale_n_sign_posn(struct _Locale_monetary *__loc) 00613 { 00614 return *(nl_langinfo_l(N_SIGN_POSN, (locale_t)__loc)); 00615 } 00616 00617 00618 /* Time */ 00619 const char *_Locale_full_monthname(struct _Locale_time *__loc, int _m ) 00620 { 00621 return nl_langinfo_l(MON_1 + _m, (locale_t)__loc); 00622 } 00623 00624 const char *_Locale_abbrev_monthname(struct _Locale_time *__loc, int _m ) 00625 { 00626 return nl_langinfo_l(ABMON_1 + _m, (locale_t)__loc); 00627 } 00628 00629 const char *_Locale_full_dayofweek(struct _Locale_time *__loc, int _d ) 00630 { 00631 return nl_langinfo_l(DAY_1 + _d, (locale_t)__loc); 00632 } 00633 00634 const char *_Locale_abbrev_dayofweek(struct _Locale_time *__loc, int _d ) 00635 { 00636 return nl_langinfo_l(ABDAY_1 + _d, (locale_t)__loc); 00637 } 00638 00639 const char *_Locale_d_t_fmt(struct _Locale_time *__loc) 00640 { 00641 return nl_langinfo_l(D_T_FMT, (locale_t)__loc); 00642 } 00643 00644 const char *_Locale_d_fmt(struct _Locale_time *__loc ) 00645 { 00646 return nl_langinfo_l(D_FMT, (locale_t)__loc); 00647 } 00648 00649 const char *_Locale_t_fmt(struct _Locale_time *__loc ) 00650 { 00651 return nl_langinfo_l(T_FMT, (locale_t)__loc); 00652 } 00653 00654 const char *_Locale_long_d_t_fmt(struct _Locale_time *__loc ) 00655 { 00656 return nl_langinfo_l(ERA_D_T_FMT, (locale_t)__loc); 00657 } 00658 00659 const char *_Locale_long_d_fmt(struct _Locale_time *__loc ) 00660 { 00661 return nl_langinfo_l(ERA_D_FMT, (locale_t)__loc); 00662 } 00663 00664 const char *_Locale_am_str(struct _Locale_time *__loc ) 00665 { 00666 return nl_langinfo_l(AM_STR, (locale_t)__loc); 00667 } 00668 00669 const char *_Locale_pm_str(struct _Locale_time* __loc ) 00670 { 00671 return nl_langinfo_l(PM_STR, (locale_t)__loc); 00672 } 00673 00674 #ifndef _STLP_NO_WCHAR_T 00675 const wchar_t *_WLocale_full_monthname(struct _Locale_time *__loc, int _m, wchar_t *buf, size_t bufSize) 00676 { return _ToWChar(_Locale_full_monthname(__loc, _m), buf, bufSize); } 00677 const wchar_t *_WLocale_abbrev_monthname(struct _Locale_time *__loc, int _m, wchar_t *buf, size_t bufSize) 00678 { return _ToWChar(_Locale_abbrev_monthname(__loc, _m), buf, bufSize); } 00679 const wchar_t *_WLocale_full_dayofweek(struct _Locale_time *__loc, int _d, wchar_t *buf, size_t bufSize) 00680 { return _ToWChar(_Locale_full_dayofweek(__loc, _d), buf, bufSize); } 00681 const wchar_t *_WLocale_abbrev_dayofweek(struct _Locale_time *__loc, int _d, wchar_t *buf, size_t bufSize) 00682 { return _ToWChar(_Locale_abbrev_dayofweek(__loc, _d), buf, bufSize); } 00683 const wchar_t *_WLocale_am_str(struct _Locale_time *__loc, wchar_t *buf, size_t bufSize) 00684 { return _ToWChar(_Locale_am_str(__loc), buf, bufSize); } 00685 const wchar_t *_WLocale_pm_str(struct _Locale_time* __loc, wchar_t *buf, size_t bufSize) 00686 { return _ToWChar(_Locale_pm_str(__loc), buf, bufSize); } 00687 #endif 00688 00689 /* Messages */ 00690 00691 nl_catd_type _Locale_catopen(struct _Locale_messages *__loc, const char *__cat_name ) 00692 { 00693 return catopen( __cat_name, NL_CAT_LOCALE ); 00694 } 00695 00696 void _Locale_catclose(struct _Locale_messages *__loc, nl_catd_type __cat ) 00697 { 00698 catclose( __cat ); 00699 } 00700 00701 const char *_Locale_catgets(struct _Locale_messages *__loc, nl_catd_type __cat, 00702 int __setid, int __msgid, const char *dfault) 00703 { 00704 return catgets( __cat, __setid, __msgid, dfault ); 00705 } Generated on Fri May 25 2012 04:33:38 for ReactOS by
1.7.6.1
|