/home/ntakagi/work/STLport-5.1.5/src/c_locale_glibc/c_locale_glibc2.c

Go to the documentation of this file.
00001 
00002 #include <locale.h>
00003 #include <langinfo.h>
00004 
00005 #include <stl/c_locale.h>
00006 #include <stdio.h>
00007 #include <wctype.h>
00008 #include <string.h>
00009 
00010 #include <stdint.h>
00011 
00012 /* Structure describing locale data in core for a category.  */
00013 /* GLIBC internal, see <glibc catalog>/locale/localeinfo.h */
00014 #if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ > 2))
00015 
00016 /* GLIBC 2.3.x */
00017 struct locale_data
00018 {
00019   const char *name;
00020   const char *filedata;         /* Region mapping the file data.  */
00021   off_t filesize;               /* Size of the file (and the region).  */
00022   enum                          /* Flavor of storage used for those.  */
00023   {
00024     ld_malloced,                /* Both are malloc'd.  */
00025     ld_mapped,                  /* name is malloc'd, filedata mmap'd */
00026     ld_archive                  /* Both point into mmap'd archive regions.  */
00027   } alloc;
00028 
00029   /* This provides a slot for category-specific code to cache data computed
00030    * about this locale.  That code can set a cleanup function to deallocate
00031    * the data.
00032   struct
00033   {
00034     void (*cleanup) (struct locale_data *);
00035     union
00036     {
00037       void *data;
00038       struct lc_time_data *time;
00039       const struct gconv_fcts *ctype;
00040     };
00041   } private;
00042    */
00043 
00044   unsigned int usage_count;     /* Counter for users.  */
00045 
00046   int use_translit;             /* Nonzero if the mb*towv*() and wc*tomb()
00047                                    functions should use transliteration.  */
00048 
00049   unsigned int nstrings;        /* Number of strings below.  */
00050   union locale_data_value
00051   {
00052     const uint32_t *wstr;
00053     const char *string;
00054     unsigned int word;          /* Note endian issues vs 64-bit pointers.  */
00055   }
00056   values[1];     /* Items, usually pointers into `filedata'.  */
00057 };
00058 
00059 #else /* GLIBC 2.2.x */
00060 
00061 struct locale_data
00062 {
00063   const char *name;
00064   const char *filedata;         /* Region mapping the file data.  */
00065   off_t filesize;               /* Size of the file (and the region).  */
00066   int mmaped;                   /* If nonzero the data is mmaped.  */
00067 
00068   unsigned int usage_count;     /* Counter for users.  */
00069 
00070   int use_translit;             /* Nonzero if the mb*towv*() and wc*tomb()
00071                                    functions should use transliteration.  */
00072   const char *options;          /* Extra options from the locale name,
00073                                    not used in the path to the locale data.  */
00074 
00075   unsigned int nstrings;        /* Number of strings below.  */
00076   union locale_data_value
00077   {
00078     const uint32_t *wstr;
00079     const char *string;
00080     unsigned int word;
00081   }
00082   values[1];     /* Items, usually pointers into `filedata'.  */
00083 };
00084 
00085 #endif
00086 
00087 
00088 typedef __locale_t __c_locale;
00089 
00090 #if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ > 2))
00091 # define __nl_langinfo_l nl_langinfo_l
00092 #endif
00093 
00094 #if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ > 2))
00095 #  define __LOCALE_CREATE(nm,category) (void*)newlocale(1 << category, nm, NULL )
00096 #  define __LOCALE_DESTROY(__loc)      freelocale((__c_locale)__loc)
00097 #else
00098 #  define __LOCALE_CREATE(nm,category) (void*)__newlocale(1 << category, nm, NULL )
00099 #  define __LOCALE_DESTROY(__loc)      __freelocale((__c_locale)__loc)
00100 #endif
00101 
00102 static const char *_empty_str = "";
00103 static const char *_C_name = "C";
00104 
00105 
00106 #if 0
00107 struct _Locale_ctype
00108 {
00109   __c_locale __cloc;
00110 };
00111 
00112 struct _Locale_numeric
00113 {
00114   __c_locale __cloc;
00115 };
00116 
00117 struct _Locale_time
00118 {
00119   __c_locale __cloc;
00120 };
00121 
00122 struct _Locale_collate
00123 {
00124   __c_locale __cloc;
00125 };
00126 
00127 struct _Locale_monetary
00128 {
00129   __c_locale __cloc;
00130 };
00131 
00132 struct _Locale_messages
00133 {
00134   __c_locale __cloc;
00135 };
00136 #endif
00137 
00138 void _Locale_init()
00139 {}
00140 
00141 void _Locale_final()
00142 {}
00143 
00144 void *_Locale_ctype_create( const char *nm, struct _Locale_name_hint* hint )
00145 { return __LOCALE_CREATE( nm, LC_CTYPE ); }
00146 
00147 void* _Locale_numeric_create( const char *nm, struct _Locale_name_hint* hint )
00148 { return __LOCALE_CREATE( nm, LC_NUMERIC ); }
00149 
00150 void* _Locale_time_create( const char *nm, struct _Locale_name_hint* hint )
00151 { return __LOCALE_CREATE( nm, LC_TIME ); }
00152 
00153 void *_Locale_collate_create( const char *nm, struct _Locale_name_hint* hint )
00154 { return __LOCALE_CREATE( nm, LC_COLLATE ); }
00155 
00156 void *_Locale_monetary_create( const char *nm, struct _Locale_name_hint* hint )
00157 { return __LOCALE_CREATE( nm, LC_MONETARY ); }
00158 
00159 void *_Locale_messages_create( const char *nm, struct _Locale_name_hint* hint )
00160 { return __LOCALE_CREATE( nm, LC_MESSAGES ); }
00161 
00162 /*
00163   try to see locale category LC should be used from environment;
00164   according POSIX, the order is
00165   1. LC_ALL
00166   2. category (LC_CTYPE, LC_NUMERIC, ... )
00167   3. LANG
00168   If set nothing, return "C" (this really implemetation-specific).
00169 */
00170 const char *_Locale_aux_default( const char *LC, char *nm )
00171 {
00172   char *name = getenv( "LC_ALL" );
00173 
00174   if ( name != NULL && *name != 0 ) {
00175     return strncpy( nm, name, _Locale_MAX_SIMPLE_NAME );
00176   }
00177   name = getenv( LC );
00178   if ( name != NULL && *name != 0 ) {
00179     return strncpy( nm, name, _Locale_MAX_SIMPLE_NAME );
00180   }
00181   name = getenv( "LANG" );
00182   if ( name != NULL && *name != 0 ) {
00183     return strncpy( nm, name, _Locale_MAX_SIMPLE_NAME );
00184   }
00185 
00186   return strcpy( nm, "C" );
00187 }
00188 
00189 const char *_Locale_ctype_default( char *nm )
00190 {
00191   return _Locale_aux_default( "LC_CTYPE", nm );
00192 }
00193 
00194 const char *_Locale_numeric_default( char *nm )
00195 {
00196   return _Locale_aux_default( "LC_NUMERIC", nm );
00197 }
00198 
00199 const char *_Locale_time_default( char *nm )
00200 {
00201   return _Locale_aux_default( "LC_TIME", nm );
00202 }
00203 
00204 const char *_Locale_collate_default( char *nm )
00205 {
00206   return _Locale_aux_default( "LC_COLLATE", nm );
00207 }
00208 
00209 const char *_Locale_monetary_default( char *nm )
00210 {
00211   return _Locale_aux_default( "LC_MONETARY", nm );
00212 }
00213 
00214 const char *_Locale_messages_default( char *nm )
00215 {
00216   return _Locale_aux_default( "LC_MESSAGES", nm );
00217 }
00218 
00219 char const*_Locale_ctype_name( const void *__loc, char *buf )
00220 {
00221   return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_CTYPE]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
00222 }
00223 
00224 char const*_Locale_numeric_name( const void *__loc, char *buf )
00225 {
00226   return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_NUMERIC]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
00227 }
00228 
00229 char const*_Locale_time_name( const void *__loc, char *buf )
00230 {
00231   return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_TIME]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
00232 }
00233 
00234 char const*_Locale_collate_name( const void *__loc, char *buf )
00235 {
00236   return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_COLLATE]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
00237 }
00238 
00239 char const*_Locale_monetary_name( const void *__loc, char *buf )
00240 {
00241   return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_MONETARY]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
00242 }
00243 
00244 char const*_Locale_messages_name( const void *__loc, char *buf )
00245 {
00246   return __loc != 0 ? strncpy( buf, ((__c_locale)__loc)->__locales[LC_MESSAGES]->name, _Locale_MAX_SIMPLE_NAME ) : 0;
00247 }
00248 
00249 void _Locale_ctype_destroy( void *__loc )
00250 { __LOCALE_DESTROY(__loc); }
00251 
00252 void _Locale_numeric_destroy( void *__loc )
00253 { __LOCALE_DESTROY(__loc); }
00254 
00255 void _Locale_time_destroy( void *__loc )
00256 { __LOCALE_DESTROY(__loc); }
00257 
00258 void _Locale_collate_destroy( void *__loc )
00259 { __LOCALE_DESTROY(__loc); }
00260 
00261 void _Locale_monetary_destroy( void *__loc )
00262 { __LOCALE_DESTROY(__loc); }
00263 
00264 void _Locale_messages_destroy( void* __loc )
00265 { __LOCALE_DESTROY(__loc); }
00266 
00267 /*
00268  * locale loc expected either locale name indeed (platform-specific)
00269  * or string like "LC_CTYPE=LocaleNameForCType;LC_NUMERIC=LocaleNameForNum;"
00270  *
00271  */
00272 
00273 char const*__Extract_locale_name( const char *loc, const char *category, char *buf )
00274 {
00275   char *expr;
00276   size_t len_name;
00277   buf[0] = 0;
00278 
00279   if( loc[0]=='L' && loc[1]=='C' && loc[2]=='_') {
00280     expr = strstr( (char*)loc, category );
00281     if ( expr == NULL )
00282       return NULL; /* Category not found. */
00283     ++expr;
00284     len_name = strcspn( expr, ";" );
00285     len_name = len_name >= _Locale_MAX_SIMPLE_NAME ? _Locale_MAX_SIMPLE_NAME - 1: len_name;
00286     strncpy( buf, expr, len_name );
00287     buf[len_name] = 0;
00288     return buf;
00289   }
00290   return strncpy( buf, loc, _Locale_MAX_SIMPLE_NAME );
00291 }
00292 
00293 char const*_Locale_extract_ctype_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
00294 { return __Extract_locale_name( loc, "LC_CTYPE=", buf ); }
00295 
00296 char const*_Locale_extract_numeric_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
00297 { return __Extract_locale_name( loc, "LC_NUMERIC=", buf ); }
00298 
00299 char const*_Locale_extract_time_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
00300 { return __Extract_locale_name( loc, "LC_TIME=", buf ); }
00301 
00302 char const*_Locale_extract_collate_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
00303 { return __Extract_locale_name( loc, "LC_COLLATE=", buf ); }
00304 
00305 char const*_Locale_extract_monetary_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
00306 { return __Extract_locale_name( loc, "LC_MONETARY=", buf ); }
00307 
00308 char const*_Locale_extract_messages_name( const char *loc, char *buf, struct _Locale_name_hint* hint )
00309 { return __Extract_locale_name( loc, "LC_MESSAGES=", buf ); }
00310 
00311 char const*_Locale_compose_name(char*__DUMMY_PAR1, const char*__DUMMY_PAR2, const char*__DUMMY_PAR3,
00312                             const char*__DUMMY_PAR4,
00313                             const char*__DUMMY_PAR5, const char*__DUMMY_PAR6, const char*__DUMMY_PAR7, const char*__DUMMY_PAR8) {
00314   /* TODO: what's this? Is this a marker that this is not yet completely
00315   implemented? Copy the implementation from c_locale_win32 perhaps? It seems
00316   to complement the extract functions above. */
00317   printf( "%s:%d\n", __FILE__, __LINE__ );
00318   return 0;
00319 }
00320 
00321 struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
00322 { return 0; }
00323 struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
00324 { return 0; }
00325 struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
00326 { return 0; }
00327 struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
00328 { return 0; }
00329 struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
00330 { return 0; }
00331 struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
00332 { return 0; }
00333 
00334 /* ctype */
00335 
00336 const _Locale_mask_t *_Locale_ctype_table( struct _Locale_ctype *__loc )
00337 {
00338   /* return table with masks (upper, lower, alpha, etc.) */
00339   /* return ((__c_locale)__loc)->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS)].string + 128; */
00340   return ((__c_locale)__loc)->__ctype_b;
00341 }
00342 
00343 int _Locale_toupper( struct _Locale_ctype *__loc, int c )
00344 { return ((__c_locale)__loc)->__ctype_toupper[c]; }
00345 
00346 int _Locale_tolower( struct _Locale_ctype *__loc, int c )
00347 { return ((__c_locale)__loc)->__ctype_tolower[c]; }
00348 
00349 #if !defined (_STLP_NO_WCHAR_T)
00350 _Locale_mask_t _Locale_wchar_ctype(struct _Locale_ctype*__DUMMY_PAR1, wint_t __DUMMY_PAR2, _Locale_mask_t __DUMMY_PAR3) {
00351   printf( "%s:%d\n", __FILE__, __LINE__ );
00352   return 0;
00353 }
00354 
00355 wint_t _Locale_wchar_tolower( struct _Locale_ctype *__loc, wint_t c ) {
00356   printf( "%s:%d\n", __FILE__, __LINE__ );
00357   return __towlower_l( c, ((__c_locale)__loc) );
00358 }
00359 
00360 wint_t _Locale_wchar_toupper( struct _Locale_ctype *__loc, wint_t c ) {
00361   printf( "%s:%d\n", __FILE__, __LINE__ );
00362   return __towupper_l( c, ((__c_locale)__loc) );
00363 }
00364 #endif
00365 
00366 #if !defined (_STLP_NO_MBSTATE_T)
00367 
00368 int _Locale_mb_cur_max( struct _Locale_ctype * __DUMMY_PAR) {
00369   printf( "%s:%d\n", __FILE__, __LINE__ );
00370   return 0;
00371 }
00372 
00373 int _Locale_mb_cur_min( struct _Locale_ctype * __DUMMY_PAR) {
00374   printf( "%s:%d\n", __FILE__, __LINE__ );
00375   return 0;
00376 }
00377 
00378 int _Locale_is_stateless( struct _Locale_ctype * __DUMMY_PAR) {
00379   printf( "%s:%d\n", __FILE__, __LINE__ );
00380   return 1;
00381 }
00382 
00383 #if !defined (_STLP_NO_WCHAR_T)
00384 wint_t _Locale_btowc(struct _Locale_ctype *__loc, int c) {
00385   wint_t _c;
00386   /* __c_locale __tmp = __uselocale( __loc ); */
00387   _c = btowc( c );
00388   /* __uselocale( __tmp ); */
00389   return _c;
00390 }
00391 
00392 int _Locale_wctob(struct _Locale_ctype *__loc, wint_t c) {
00393   int _c;
00394   /* __c_locale __tmp = __uselocale( __loc ); */
00395   _c = wctob( c );
00396   /* __uselocale( __tmp ); */
00397   return _c;
00398 }
00399 
00400 size_t _Locale_mbtowc(struct _Locale_ctype *__DUMMY_PAR1,
00401                       wchar_t *__DUMMY_PAR2,
00402                       const char *__DUMMY_PAR3, size_t __DUMMY_PAR4,
00403                       mbstate_t *__DUMMY_PAR5) {
00404   printf( "%s:%d\n", __FILE__, __LINE__ );
00405   return (size_t) -1;
00406 }
00407 
00408 size_t _Locale_wctomb(struct _Locale_ctype *__DUMMY_PAR1,
00409                       char *__DUMMY_PAR2, size_t __DUMMY_PAR3,
00410                       const wchar_t __DUMMY_PAR4,
00411                       mbstate_t *__DUMMY_PAR5) {
00412   printf( "%s:%d\n", __FILE__, __LINE__ );
00413   return (size_t) -1;
00414 }
00415 #endif
00416 
00417 size_t _Locale_unshift(struct _Locale_ctype *__DUMMY_PAR1,
00418                        mbstate_t *__DUMMY_PAR2,
00419                        char *__DUMMY_PAR3, size_t __DUMMY_PAR4, char ** __DUMMY_PAR5) {
00420   printf( "%s:%d\n", __FILE__, __LINE__ );
00421   return (size_t) -1;
00422 }
00423 
00424 #endif /*  _STLP_NO_MBSTATE_T */
00425 
00426 /* Collate */
00427 int _Locale_strcmp(struct _Locale_collate * __loc,
00428                    const char *s1, size_t n1,
00429                    const char *s2, size_t n2) {
00430   int ret;
00431   char buf1[64], buf2[64];
00432   while (n1 > 0 && n2 > 0) {
00433     size_t bufsize1 = n1 < 63 ? n1 : 63;
00434     size_t bufsize2 = n2 < 63 ? n2 : 63;
00435     strncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0;
00436     strncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0;
00437 
00438     ret = strcoll_l(buf1, buf2, (__c_locale)__loc);
00439     if (ret != 0) return ret;
00440     s1 += bufsize1; n1 -= bufsize1;
00441     s2 += bufsize2; n2 -= bufsize2;
00442   }
00443   return ret;
00444 }
00445 
00446 #if !defined (_STLP_NO_WCHAR_T)
00447 int _Locale_strwcmp(struct _Locale_collate *__loc,
00448                     const wchar_t *s1, size_t n1,
00449                     const wchar_t *s2, size_t n2) {
00450   int ret;
00451   wchar_t buf1[64], buf2[64];
00452   while (n1 > 0 && n2 > 0) {
00453     size_t bufsize1 = n1 < 63 ? n1 : 63;
00454     size_t bufsize2 = n2 < 63 ? n2 : 63;
00455     wcsncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0;
00456     wcsncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0;
00457 
00458     ret = wcscoll_l(buf1, buf2, (__c_locale)__loc);
00459     if (ret != 0) return ret;
00460     s1 += bufsize1; n1 -= bufsize1;
00461     s2 += bufsize2; n2 -= bufsize2;
00462   }
00463   return ret;
00464 }
00465 
00466 #endif
00467 
00468 size_t _Locale_strxfrm(struct _Locale_collate *__loc,
00469                        char *dest, size_t dest_n,
00470                        const char *src, size_t src_n )
00471 {
00472   const char *real_src;
00473   char *buf = NULL;
00474   size_t result;
00475 
00476   if (src_n == 0)
00477   {
00478     if (dest != NULL) dest[0] = 0;
00479     return 0;
00480   }
00481   if (src[src_n] != 0) {
00482     buf = malloc(src_n + 1);
00483     strncpy(buf, src, src_n);
00484     buf[src_n] = 0;
00485     real_src = buf;
00486   }
00487   else
00488     real_src = src;
00489   result = __strxfrm_l(dest, real_src, dest_n, (__c_locale)__loc);
00490   if (buf != NULL) free(buf);
00491   return result;
00492 }
00493 
00494 # ifndef _STLP_NO_WCHAR_T
00495 
00496 size_t _Locale_strwxfrm( struct _Locale_collate *__loc,
00497                           wchar_t *dest, size_t dest_n,
00498                           const wchar_t *src, size_t src_n )
00499 {
00500   const wchar_t *real_src;
00501   wchar_t *buf = NULL;
00502   size_t result;
00503 
00504   if (src_n == 0)
00505   {
00506     if (dest != NULL) dest[0] = 0;
00507     return 0;
00508   }
00509   if (src[src_n] != 0) {
00510     buf = malloc((src_n + 1) * sizeof(wchar_t));
00511     wcsncpy(buf, src, src_n);
00512     buf[src_n] = 0;
00513     real_src = buf;
00514   }
00515   else
00516     real_src = src;
00517   result = __wcsxfrm_l(dest, real_src, dest_n, (__c_locale)__loc);
00518   if (buf != NULL) free(buf);
00519   return result;
00520 }
00521 
00522 # endif
00523 
00524 /* Numeric */
00525 
00526 char _Locale_decimal_point(struct _Locale_numeric *__loc)
00527 {
00528   return (__loc != 0) ? *(__nl_langinfo_l(RADIXCHAR, (__c_locale)__loc)) : '.';
00529 }
00530 
00531 char _Locale_thousands_sep(struct _Locale_numeric *__loc)
00532 {
00533   return (__loc != 0) ? *(__nl_langinfo_l(THOUSEP, (__c_locale)__loc)) : ',';
00534 }
00535 
00536 const char* _Locale_grouping(struct _Locale_numeric *__loc)
00537 {
00538   return (__loc != 0 && _Locale_thousands_sep(__loc) != '\0' ) ?
00539     (__nl_langinfo_l(GROUPING, (__c_locale)__loc)) : "";
00540 }
00541 
00542 const char *_Locale_true(struct _Locale_numeric *__loc)
00543 {
00544   return __loc != 0 ? __nl_langinfo_l(YESSTR, (__c_locale)__loc) : "true";
00545 }
00546 
00547 const char *_Locale_false(struct _Locale_numeric *__loc)
00548 {
00549   return __loc != 0 ? __nl_langinfo_l(NOSTR, (__c_locale)__loc) : "false";
00550 }
00551 
00552 
00553 /* Monetary */
00554 
00555 const char *_Locale_int_curr_symbol(struct _Locale_monetary *__loc)
00556 {
00557   return __loc != 0 ? __nl_langinfo_l(INT_CURR_SYMBOL, (__c_locale)__loc) : 0;
00558 }
00559 
00560 const char *_Locale_currency_symbol(struct _Locale_monetary *__loc)
00561 {
00562   return __loc != 0 ? __nl_langinfo_l(CURRENCY_SYMBOL, (__c_locale)__loc) : 0;
00563 }
00564 
00565 char _Locale_mon_decimal_point(struct _Locale_monetary * __loc)
00566 {
00567   return __loc != 0 ? *(__nl_langinfo_l(MON_DECIMAL_POINT,(__c_locale)__loc)) : '.';
00568 }
00569 
00570 char _Locale_mon_thousands_sep(struct _Locale_monetary *__loc)
00571 {
00572   return __loc != 0 ? *(__nl_langinfo_l(MON_THOUSANDS_SEP, (__c_locale)__loc)) : ',';
00573 }
00574 
00575 const char *_Locale_mon_grouping(struct _Locale_monetary *__loc)
00576 {
00577   return (__loc != 0 && _Locale_mon_thousands_sep( __loc ) != '\0' ) ?
00578     __nl_langinfo_l(MON_GROUPING, (__c_locale)__loc) : _empty_str;
00579 }
00580 
00581 const char *_Locale_positive_sign(struct _Locale_monetary *__loc)
00582 {
00583   return __loc != 0 ? __nl_langinfo_l(POSITIVE_SIGN, (__c_locale)__loc) : _empty_str;
00584 }
00585 
00586 const char *_Locale_negative_sign(struct _Locale_monetary *__loc)
00587 {
00588   return __loc != 0 ? __nl_langinfo_l(NEGATIVE_SIGN, (__c_locale)__loc) : _empty_str;
00589 }
00590 
00591 char _Locale_int_frac_digits(struct _Locale_monetary *__loc)
00592 {
00593   return __loc != 0 ? *(__nl_langinfo_l(INT_FRAC_DIGITS, (__c_locale)__loc)) : CHAR_MAX;
00594 }
00595 
00596 char _Locale_frac_digits(struct _Locale_monetary *__loc)
00597 {
00598   return __loc != 0 ? *(__nl_langinfo_l(FRAC_DIGITS, (__c_locale)__loc)) : CHAR_MAX;
00599 }
00600 
00601 /* 1 if currency_symbol precedes a positive value, 0 if succeeds */
00602 int _Locale_p_cs_precedes(struct _Locale_monetary *__loc)
00603 {
00604   return __loc != 0 ? *(__nl_langinfo_l(P_CS_PRECEDES, (__c_locale)__loc)) : CHAR_MAX;
00605 }
00606 
00607 /* 1 if a space separates currency_symbol from a positive value. */
00608 int _Locale_p_sep_by_space(struct _Locale_monetary *__loc)
00609 {
00610   return __loc != 0 ? *(__nl_langinfo_l(P_SEP_BY_SPACE, (__c_locale)__loc)) : CHAR_MAX;
00611 }
00612 
00613 /*
00614  * 0 Parentheses surround the quantity and currency_symbol
00615  * 1 The sign string precedes the quantity and currency_symbol
00616  * 2 The sign string succeeds the quantity and currency_symbol.
00617  * 3 The sign string immediately precedes the currency_symbol.
00618  * 4 The sign string immediately succeeds the currency_symbol.
00619  */
00620 int _Locale_p_sign_posn(struct _Locale_monetary *__loc)
00621 {
00622   return __loc != 0 ? *(__nl_langinfo_l(P_SIGN_POSN, (__c_locale)__loc)) : CHAR_MAX;
00623 }
00624 
00625 /* 1 if currency_symbol precedes a negative value, 0 if succeeds */
00626 int _Locale_n_cs_precedes(struct _Locale_monetary *__loc)
00627 {
00628   return __loc != 0 ? *(__nl_langinfo_l(N_CS_PRECEDES, (__c_locale)__loc)) : CHAR_MAX;
00629 }
00630 
00631 /* 1 if a space separates currency_symbol from a negative value. */
00632 int _Locale_n_sep_by_space(struct _Locale_monetary *__loc)
00633 {
00634   return __loc != 0 ? *(__nl_langinfo_l(N_SEP_BY_SPACE, (__c_locale)__loc)) : CHAR_MAX;
00635 }
00636 
00637 /*
00638  * 0 Parentheses surround the quantity and currency_symbol
00639  * 1 The sign string precedes the quantity and currency_symbol
00640  * 2 The sign string succeeds the quantity and currency_symbol.
00641  * 3 The sign string immediately precedes the currency_symbol.
00642  * 4 The sign string immediately succeeds the currency_symbol.
00643  */
00644 int _Locale_n_sign_posn(struct _Locale_monetary *__loc)
00645 {
00646   return __loc != 0 ? *(__nl_langinfo_l(N_SIGN_POSN, (__c_locale)__loc)) : CHAR_MAX;
00647 }
00648 
00649 
00650 /* Time */
00651 const char *_Locale_full_monthname(struct _Locale_time *__loc, int _m )
00652 {
00653   return (__loc != 0 && _m >= 0 && _m < 12) ? __nl_langinfo_l(MON_1 + _m, (__c_locale)__loc) : 0;
00654 }
00655 
00656 const char *_Locale_abbrev_monthname(struct _Locale_time *__loc, int _m )
00657 {
00658   return (__loc != 0 && _m >= 0 && _m < 12) ? __nl_langinfo_l(ABMON_1 + _m, (__c_locale)__loc) : 0;
00659 }
00660 
00661 const char *_Locale_full_dayofweek(struct _Locale_time *__loc, int _d )
00662 {
00663   return (__loc != 0 && _d >= 0 && _d < 7) ? __nl_langinfo_l(DAY_1 + _d, (__c_locale)__loc) : 0;
00664 }
00665 
00666 const char *_Locale_abbrev_dayofweek(struct _Locale_time *__loc, int _d )
00667 {
00668   return (__loc != 0 && _d >= 0 && _d < 7) ? __nl_langinfo_l(ABDAY_1 + _d, (__c_locale)__loc) : 0;
00669 }
00670 
00671 const char *_Locale_d_t_fmt(struct _Locale_time *__loc)
00672 {
00673   return __loc != 0 ? __nl_langinfo_l(D_T_FMT, (__c_locale)__loc) : 0;
00674 }
00675 
00676 const char *_Locale_d_fmt(struct _Locale_time *__loc )
00677 {
00678   return __loc != 0 ? __nl_langinfo_l(D_FMT, (__c_locale)__loc) : 0;
00679 }
00680 
00681 const char *_Locale_t_fmt(struct _Locale_time *__loc )
00682 {
00683   return __loc != 0 ? __nl_langinfo_l(T_FMT, (__c_locale)__loc) : 0;
00684 }
00685 
00686 const char *_Locale_long_d_t_fmt(struct _Locale_time *__loc )
00687 {
00688   return __loc != 0 ? __nl_langinfo_l(ERA_D_T_FMT, (__c_locale)__loc) : 0;
00689 }
00690 
00691 const char *_Locale_long_d_fmt(struct _Locale_time *__loc )
00692 {
00693   return __loc != 0 ? __nl_langinfo_l(ERA_D_FMT, (__c_locale)__loc) : 0;
00694 }
00695 
00696 const char *_Locale_am_str(struct _Locale_time *__loc )
00697 {
00698   return __loc != 0 ? __nl_langinfo_l(AM_STR, (__c_locale)__loc) : _empty_str;
00699 }
00700 
00701 const char *_Locale_pm_str(struct _Locale_time* __loc )
00702 {
00703   return __loc != 0 ? __nl_langinfo_l(PM_STR, (__c_locale)__loc) : _empty_str;
00704 }
00705 
00706 const char *_Locale_t_fmt_ampm(struct _Locale_time *__loc )
00707 {
00708   return __loc != 0 ? __nl_langinfo_l(T_FMT_AMPM, (__c_locale)__loc) : 0;
00709 }
00710 
00711 /* Messages */
00712 
00713 nl_catd_type _Locale_catopen(struct _Locale_messages *__loc, const char *__cat_name )
00714 {
00715   return catopen( __cat_name, NL_CAT_LOCALE );
00716 }
00717 
00718 void _Locale_catclose(struct _Locale_messages *__loc, nl_catd_type __cat )
00719 {
00720   catclose( __cat );
00721 }
00722 
00723 const char *_Locale_catgets(struct _Locale_messages *__loc, nl_catd_type __cat,
00724                             int __setid, int __msgid, const char *dfault)
00725 {
00726   return catgets( __cat, __setid, __msgid, dfault );
00727 }



Generated on Mon Mar 10 15:32:15 2008 by  doxygen 1.5.1