build/stlport/src/c_locale_dummy/c_locale_dummy.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/stlport/src/c_locale_dummy/c_locale_dummy.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,531 @@
     1.4 +/*
     1.5 + * Copyright (c) 1999
     1.6 + * Silicon Graphics Computer Systems, Inc.
     1.7 + *
     1.8 + * Copyright (c) 1999
     1.9 + * Boris Fomitchev
    1.10 + *
    1.11 + * This material is provided "as is", with absolutely no warranty expressed
    1.12 + * or implied. Any use is at your own risk.
    1.13 + *
    1.14 + * Permission to use or copy this software for any purpose is hereby granted
    1.15 + * without fee, provided the above notices are retained on all copies.
    1.16 + * Permission to modify the code and to distribute modified code is granted,
    1.17 + * provided the above notices are retained, and a notice that the code was
    1.18 + * modified is included with the above copyright notice.
    1.19 + *
    1.20 + */
    1.21 +
    1.22 +/* This is a "stub" implementation of the "c_locale.h" interface,
    1.23 +   intended for operating systems where we have not yet written
    1.24 +   a real implementation.  A C++ library using this stub implementation
    1.25 +   is still standard-conforming, since the C++ standard does not require
    1.26 +   that any locales other than "C" be supported.
    1.27 +*/
    1.28 +
    1.29 +#include <string.h>
    1.30 +#include <wchar.h>
    1.31 +#include <ctype.h>
    1.32 +#include <wctype.h>
    1.33 +#include <limits.h>
    1.34 +
    1.35 +#if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
    1.36 +#  define _STLP_STRNCPY(D, DS, S, C) strncpy_s(D, DS, S, C)
    1.37 +#  if !defined (_STLP_NO_WCHAR_T)
    1.38 +#    define _STLP_WCSNCPY(D, DS, S, C) wcsncpy_s(D, DS, S, C)
    1.39 +#  endif
    1.40 +#else
    1.41 +#  define _STLP_STRNCPY(D, DS, S, C) strncpy(D, S, C)
    1.42 +#  if !defined (_STLP_NO_WCHAR_T)
    1.43 +#    define _STLP_WCSNCPY(D, DS, S, C) wcsncpy(D, S, C)
    1.44 +#  endif
    1.45 +#endif
    1.46 +
    1.47 +static const char *_C_name = "C";
    1.48 +static const char *_empty_str = "";
    1.49 +#ifndef _STLP_NO_WCHAR_T
    1.50 +#if defined(WCHAR_MAX) && WCHAR_MAX == 255
    1.51 +static const wchar_t *_empty_wstr = "";
    1.52 +#else
    1.53 +static const wchar_t *_empty_wstr = L"";
    1.54 +#endif
    1.55 +#endif
    1.56 +
    1.57 +static _Locale_mask_t ctable[256];
    1.58 +
    1.59 +/* Framework functions */
    1.60 +
    1.61 +void _Locale_init(void) {
    1.62 +  /* Ctype table for the ASCII character set. */
    1.63 +  char c;
    1.64 +  /* We might never reach 128 when char is signed. */
    1.65 +  for (c = 0; /* c != 128 */; ++c) {
    1.66 +    if (isalpha(c)) ctable[(unsigned char)c] |= _Locale_ALPHA;
    1.67 +    if (iscntrl(c)) ctable[(unsigned char)c] |= _Locale_CNTRL;
    1.68 +    if (isdigit(c)) ctable[(unsigned char)c] |= _Locale_DIGIT;
    1.69 +    if (isprint(c)) ctable[(unsigned char)c] |= _Locale_PRINT;
    1.70 +    if (ispunct(c)) ctable[(unsigned char)c] |= _Locale_PUNCT;
    1.71 +    if (isspace(c)) ctable[(unsigned char)c] |= _Locale_SPACE;
    1.72 +    if (isxdigit(c)) ctable[(unsigned char)c] |= _Locale_XDIGIT;
    1.73 +    if (isupper(c)) ctable[(unsigned char)c] |= _Locale_UPPER;
    1.74 +    if (islower(c)) ctable[(unsigned char)c] |= _Locale_LOWER;
    1.75 +    if (c == 127) break;
    1.76 +  }
    1.77 +
    1.78 +  /* ASCII is a 7-bit code, so everything else is non-ASCII. */
    1.79 +  memset(&(ctable[128]), 0, 128 * sizeof(_Locale_mask_t));
    1.80 +}
    1.81 +
    1.82 +void _Locale_final(void)
    1.83 +{}
    1.84 +
    1.85 +void* _Locale_create(const char* name, int *__err_code) {
    1.86 +  if (name[0] == 'C' && name[1] == 0)
    1.87 +  { return (void*)0x1; }
    1.88 +  *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
    1.89 +}
    1.90 +
    1.91 +struct _Locale_ctype* _Locale_ctype_create(const char *name,
    1.92 +                                           struct _Locale_name_hint* hint, int *__err_code)
    1.93 +{ return (struct _Locale_ctype*)_Locale_create(name, __err_code); }
    1.94 +
    1.95 +struct _Locale_codecvt* _Locale_codecvt_create(const char *name,
    1.96 +                                               struct _Locale_name_hint* hint, int *__err_code)
    1.97 +{ return (struct _Locale_codecvt*)_Locale_create(name, __err_code); }
    1.98 +
    1.99 +struct _Locale_numeric* _Locale_numeric_create(const char *name,
   1.100 +                                               struct _Locale_name_hint* hint, int *__err_code)
   1.101 +{ return (struct _Locale_numeric*)_Locale_create(name, __err_code); }
   1.102 +
   1.103 +struct _Locale_time* _Locale_time_create(const char *name,
   1.104 +                                         struct _Locale_name_hint* hint, int *__err_code)
   1.105 +{ return (struct _Locale_time*)_Locale_create(name, __err_code); }
   1.106 +
   1.107 +struct _Locale_collate* _Locale_collate_create(const char *name,
   1.108 +                                               struct _Locale_name_hint* hint, int *__err_code)
   1.109 +{ return (struct _Locale_collate*)_Locale_create(name, __err_code); }
   1.110 +
   1.111 +struct _Locale_monetary* _Locale_monetary_create(const char *name,
   1.112 +                                                 struct _Locale_name_hint* hint, int *__err_code)
   1.113 +{ return (struct _Locale_monetary*)_Locale_create(name, __err_code); }
   1.114 +
   1.115 +struct _Locale_messages* _Locale_messages_create(const char *name,
   1.116 +                                                 struct _Locale_name_hint* hint, int *__err_code)
   1.117 +{ return (struct _Locale_messages*)_Locale_create(name, __err_code); }
   1.118 +
   1.119 +const char *_Locale_ctype_default(char* buf)    { return _C_name; }
   1.120 +const char *_Locale_numeric_default(char * buf) { return _C_name; }
   1.121 +const char *_Locale_time_default(char* buf)     { return _C_name; }
   1.122 +const char *_Locale_collate_default(char* buf)  { return _C_name; }
   1.123 +const char *_Locale_monetary_default(char* buf) { return _C_name; }
   1.124 +const char *_Locale_messages_default(char* buf) { return _C_name; }
   1.125 +
   1.126 +char const* _Locale_ctype_name(const struct _Locale_ctype *lctype, char* buf)
   1.127 +{ return _C_name; }
   1.128 +
   1.129 +char const* _Locale_codecvt_name(const struct _Locale_codecvt *lcodecvt, char* buf)
   1.130 +{ return _C_name; }
   1.131 +
   1.132 +char const* _Locale_numeric_name(const struct _Locale_numeric *lnum, char* buf)
   1.133 +{ return _C_name; }
   1.134 +
   1.135 +char const* _Locale_time_name(const struct _Locale_time *ltime, char* buf)
   1.136 +{ return _C_name; }
   1.137 +
   1.138 +char const* _Locale_collate_name(const struct _Locale_collate *lcol, char* buf)
   1.139 +{ return _C_name; }
   1.140 +
   1.141 +char const* _Locale_monetary_name(const struct _Locale_monetary *lmon, char* buf)
   1.142 +{ return _C_name; }
   1.143 +
   1.144 +char const* _Locale_messages_name(const struct _Locale_messages *lmes, char* buf)
   1.145 +{ return _C_name; }
   1.146 +
   1.147 +void _Locale_ctype_destroy(struct _Locale_ctype *lctype)     {}
   1.148 +void _Locale_codecvt_destroy(struct _Locale_codecvt *lcodecvt)   {}
   1.149 +void _Locale_numeric_destroy(struct _Locale_numeric *lnum)   {}
   1.150 +void _Locale_time_destroy(struct _Locale_time *ltime)        {}
   1.151 +void _Locale_collate_destroy(struct _Locale_collate *lcol)   {}
   1.152 +void _Locale_monetary_destroy(struct _Locale_monetary *lmon) {}
   1.153 +void _Locale_messages_destroy(struct _Locale_messages *lmes) {}
   1.154 +
   1.155 +static char const* _Locale_extract_name(const char* name, int *__err_code) {
   1.156 +  // When the request is the default locale or the "C" locale we answer "C".
   1.157 +  if (name[0] == 0 ||
   1.158 +      (name[0] == 'C' && name[1] == 0))
   1.159 +  {  return _C_name; }
   1.160 +  *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
   1.161 +}
   1.162 +
   1.163 +char const* _Locale_extract_ctype_name(const char *name, char *buf,
   1.164 +                                       struct _Locale_name_hint* hint, int *__err_code)
   1.165 +{ return _Locale_extract_name(name, __err_code); }
   1.166 +
   1.167 +char const* _Locale_extract_numeric_name(const char *name, char *buf,
   1.168 +                                         struct _Locale_name_hint* hint, int *__err_code)
   1.169 +{ return _Locale_extract_name(name, __err_code); }
   1.170 +
   1.171 +char const* _Locale_extract_time_name(const char*name, char *buf,
   1.172 +                                      struct _Locale_name_hint* hint, int *__err_code)
   1.173 +{ return _Locale_extract_name(name, __err_code); }
   1.174 +
   1.175 +char const* _Locale_extract_collate_name(const char *name, char *buf,
   1.176 +                                         struct _Locale_name_hint* hint, int *__err_code)
   1.177 +{ return _Locale_extract_name(name, __err_code); }
   1.178 +
   1.179 +char const* _Locale_extract_monetary_name(const char *name, char *buf,
   1.180 +                                          struct _Locale_name_hint* hint, int *__err_code)
   1.181 +{ return _Locale_extract_name(name, __err_code); }
   1.182 +
   1.183 +char const* _Locale_extract_messages_name(const char *name, char *buf,
   1.184 +                                          struct _Locale_name_hint* hint, int *__err_code)
   1.185 +{ return _Locale_extract_name(name, __err_code); }
   1.186 +
   1.187 +struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
   1.188 +{ return 0; }
   1.189 +struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
   1.190 +{ return 0; }
   1.191 +struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
   1.192 +{ return 0; }
   1.193 +struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
   1.194 +{ return 0; }
   1.195 +struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
   1.196 +{ return 0; }
   1.197 +struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
   1.198 +{ return 0; }
   1.199 +
   1.200 +/* ctype */
   1.201 +const _Locale_mask_t* _Locale_ctype_table(struct _Locale_ctype* lctype) {
   1.202 +  _STLP_MARK_PARAMETER_AS_UNUSED(lctype)
   1.203 +  return ctable;
   1.204 +}
   1.205 +
   1.206 +int _Locale_toupper(struct _Locale_ctype*lctype, int c)
   1.207 +{ return toupper(c); }
   1.208 +
   1.209 +int _Locale_tolower(struct _Locale_ctype*lctype, int c)
   1.210 +{ return tolower(c); }
   1.211 +
   1.212 +#ifndef _STLP_NO_WCHAR_T
   1.213 +_Locale_mask_t _WLocale_ctype(struct _Locale_ctype *lctype, wint_t wc, _Locale_mask_t mask) {
   1.214 +  _Locale_mask_t ret = 0;
   1.215 +  if ((mask & _Locale_ALPHA) != 0 && iswalpha(wc))
   1.216 +    ret |= _Locale_ALPHA;
   1.217 +
   1.218 +  if ((mask & _Locale_CNTRL) != 0 && iswcntrl(wc))
   1.219 +    ret |= _Locale_CNTRL;
   1.220 +
   1.221 +  if ((mask & _Locale_DIGIT) != 0 && iswdigit(wc))
   1.222 +    ret |= _Locale_DIGIT;
   1.223 +
   1.224 +  if ((mask & _Locale_PRINT) != 0 && iswprint(wc))
   1.225 +    ret |= _Locale_PRINT;
   1.226 +
   1.227 +  if ((mask & _Locale_PUNCT) != 0 && iswpunct(wc))
   1.228 +    ret |= _Locale_PUNCT;
   1.229 +
   1.230 +  if ((mask & _Locale_SPACE) != 0 && iswspace(wc))
   1.231 +    ret |= _Locale_SPACE;
   1.232 +
   1.233 +  if ((mask & _Locale_XDIGIT) != 0 && iswxdigit(wc))
   1.234 +    ret |= _Locale_XDIGIT;
   1.235 +
   1.236 +  if ((mask & _Locale_UPPER) != 0 && iswupper(wc))
   1.237 +    ret |= _Locale_UPPER;
   1.238 +
   1.239 +  if ((mask & _Locale_LOWER) != 0 && iswlower(wc))
   1.240 +    ret |= _Locale_LOWER;
   1.241 +
   1.242 +  return ret;
   1.243 +}
   1.244 +
   1.245 +wint_t _WLocale_tolower(struct _Locale_ctype *lctype, wint_t wc)
   1.246 +{ return towlower(wc); }
   1.247 +
   1.248 +wint_t _WLocale_toupper(struct _Locale_ctype *lctype, wint_t wc)
   1.249 +{ return towupper(wc); }
   1.250 +
   1.251 +int _WLocale_mb_cur_max (struct _Locale_codecvt *lcodecvt) { return 1; }
   1.252 +int _WLocale_mb_cur_min (struct _Locale_codecvt *lcodecvt) { return 1; }
   1.253 +int _WLocale_is_stateless (struct _Locale_codecvt *lcodecvt) { return 1; }
   1.254 +
   1.255 +size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt,
   1.256 +                       wchar_t *to,
   1.257 +                       const char *from, size_t n,
   1.258 +                       mbstate_t *st)
   1.259 +{ *to = *from; return 1; }
   1.260 +
   1.261 +size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt,
   1.262 +                       char *to, size_t n,
   1.263 +                       const wchar_t c,
   1.264 +                       mbstate_t *st)
   1.265 +{ *to = (char)c; return 1; }
   1.266 +
   1.267 +size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt,
   1.268 +                        mbstate_t *st,
   1.269 +                        char *buf, size_t n, char ** next)
   1.270 +{ *next = buf; return 0; }
   1.271 +#endif
   1.272 +
   1.273 +/* Collate */
   1.274 + int _Locale_strcmp(struct _Locale_collate* lcol,
   1.275 +                    const char* s1, size_t n1, const char* s2, size_t n2) {
   1.276 +  int ret = 0;
   1.277 +  char buf1[64], buf2[64];
   1.278 +  while (n1 > 0 || n2 > 0) {
   1.279 +    size_t bufsize1 = n1 < 63 ? n1 : 63;
   1.280 +    size_t bufsize2 = n2 < 63 ? n2 : 63;
   1.281 +    _STLP_STRNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0;
   1.282 +    _STLP_STRNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0;
   1.283 +
   1.284 +    ret = strcmp(buf1, buf2);
   1.285 +    if (ret != 0) return ret < 0 ? -1 : 1;
   1.286 +    s1 += bufsize1; n1 -= bufsize1;
   1.287 +    s2 += bufsize2; n2 -= bufsize2;
   1.288 +  }
   1.289 +  return ret == 0 ? 0 : (ret < 0 ? -1 : 1);
   1.290 +}
   1.291 +
   1.292 +#ifndef _STLP_NO_WCHAR_T
   1.293 +
   1.294 +int _WLocale_strcmp(struct _Locale_collate* lcol,
   1.295 +                    const wchar_t* s1, size_t n1, const wchar_t* s2, size_t n2) {
   1.296 +  int ret = 0;
   1.297 +  wchar_t buf1[64], buf2[64];
   1.298 +  while (n1 > 0 || n2 > 0) {
   1.299 +    size_t bufsize1 = n1 < 63 ? n1 : 63;
   1.300 +    size_t bufsize2 = n2 < 63 ? n2 : 63;
   1.301 +    _STLP_WCSNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0;
   1.302 +    _STLP_WCSNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0;
   1.303 +
   1.304 +    ret = wcscmp(buf1, buf2);
   1.305 +    if (ret != 0) return ret < 0 ? -1 : 1;
   1.306 +    s1 += bufsize1; n1 -= bufsize1;
   1.307 +    s2 += bufsize2; n2 -= bufsize2;
   1.308 +  }
   1.309 +  return ret == 0 ? 0 : (ret < 0 ? -1 : 1);
   1.310 +}
   1.311 +
   1.312 +#endif
   1.313 +
   1.314 +size_t _Locale_strxfrm(struct _Locale_collate* lcol,
   1.315 +                       char* dest, size_t dest_n,
   1.316 +                       const char* src, size_t src_n) {
   1.317 +  if (dest != 0) {
   1.318 +    _STLP_STRNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0;
   1.319 +  }
   1.320 +  return src_n;
   1.321 +}
   1.322 +
   1.323 +#ifndef _STLP_NO_WCHAR_T
   1.324 +
   1.325 +size_t _WLocale_strxfrm(struct _Locale_collate* lcol,
   1.326 +                        wchar_t* dest, size_t dest_n,
   1.327 +                        const wchar_t* src, size_t src_n) {
   1.328 +  if (dest != 0) {
   1.329 +    _STLP_WCSNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0;
   1.330 +  }
   1.331 +  return src_n;
   1.332 +}
   1.333 +
   1.334 +#endif
   1.335 +
   1.336 +/* Numeric */
   1.337 +
   1.338 +char _Locale_decimal_point(struct _Locale_numeric* lnum)
   1.339 +{ return '.'; }
   1.340 +char _Locale_thousands_sep(struct _Locale_numeric* lnum)
   1.341 +{ return ','; }
   1.342 +const char* _Locale_grouping(struct _Locale_numeric * lnum)
   1.343 +{ return _empty_str; }
   1.344 +const char * _Locale_true(struct _Locale_numeric * lnum)
   1.345 +{ return "true"; }
   1.346 +const char * _Locale_false(struct _Locale_numeric * lnum)
   1.347 +{ return "false"; }
   1.348 +
   1.349 +#ifndef _STLP_NO_WCHAR_T
   1.350 +wchar_t _WLocale_decimal_point(struct _Locale_numeric* lnum)
   1.351 +{ return L'.'; }
   1.352 +wchar_t _WLocale_thousands_sep(struct _Locale_numeric* lnum)
   1.353 +{ return L','; }
   1.354 +#if defined(WCHAR_MAX) && WCHAR_MAX == 255
   1.355 +const wchar_t * _WLocale_true(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
   1.356 +{ return "true"; }
   1.357 +const wchar_t * _WLocale_false(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
   1.358 +{ return "false"; }
   1.359 +#else
   1.360 +const wchar_t * _WLocale_true(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
   1.361 +{ return L"true"; }
   1.362 +const wchar_t * _WLocale_false(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
   1.363 +{ return L"false"; }
   1.364 +#endif
   1.365 +#endif
   1.366 +
   1.367 +/* Monetary */
   1.368 +
   1.369 +const char* _Locale_int_curr_symbol(struct _Locale_monetary * lmon)
   1.370 +{ return _empty_str; }
   1.371 +const char* _Locale_currency_symbol(struct _Locale_monetary * lmon)
   1.372 +{ return _empty_str; }
   1.373 +char        _Locale_mon_decimal_point(struct _Locale_monetary * lmon)
   1.374 +{ return '.'; }
   1.375 +char        _Locale_mon_thousands_sep(struct _Locale_monetary * lmon)
   1.376 +{ return ','; }
   1.377 +const char* _Locale_mon_grouping(struct _Locale_monetary * lmon)
   1.378 +{ return _empty_str; }
   1.379 +const char* _Locale_positive_sign(struct _Locale_monetary * lmon)
   1.380 +{ return _empty_str; }
   1.381 +const char* _Locale_negative_sign(struct _Locale_monetary * lmon)
   1.382 +{ return _empty_str; }
   1.383 +char        _Locale_int_frac_digits(struct _Locale_monetary * lmon)
   1.384 +{ return 0; }
   1.385 +char        _Locale_frac_digits(struct _Locale_monetary * lmon)
   1.386 +{ return 0; }
   1.387 +int         _Locale_p_cs_precedes(struct _Locale_monetary * lmon)
   1.388 +{ return CHAR_MAX; }
   1.389 +int         _Locale_p_sep_by_space(struct _Locale_monetary * lmon)
   1.390 +{ return CHAR_MAX; }
   1.391 +int         _Locale_p_sign_posn(struct _Locale_monetary * lmon)
   1.392 +{ return CHAR_MAX; }
   1.393 +int         _Locale_n_cs_precedes(struct _Locale_monetary * lmon)
   1.394 +{ return CHAR_MAX; }
   1.395 +int          _Locale_n_sep_by_space(struct _Locale_monetary * lmon)
   1.396 +{ return CHAR_MAX; }
   1.397 +int          _Locale_n_sign_posn(struct _Locale_monetary * lmon)
   1.398 +{ return CHAR_MAX; }
   1.399 +
   1.400 +#ifndef _STLP_NO_WCHAR_T
   1.401 +const wchar_t* _WLocale_int_curr_symbol(struct _Locale_monetary * lmon,
   1.402 +                                        wchar_t* buf, size_t bufSize)
   1.403 +{ return _empty_wstr; }
   1.404 +const wchar_t* _WLocale_currency_symbol(struct _Locale_monetary * lmon,
   1.405 +                                        wchar_t* buf, size_t bufSize)
   1.406 +{ return _empty_wstr; }
   1.407 +wchar_t        _WLocale_mon_decimal_point(struct _Locale_monetary * lmon)
   1.408 +{ return L'.'; }
   1.409 +wchar_t        _WLocale_mon_thousands_sep(struct _Locale_monetary * lmon)
   1.410 +{ return L','; }
   1.411 +const wchar_t* _WLocale_positive_sign(struct _Locale_monetary * lmon,
   1.412 +                                      wchar_t* buf, size_t bufSize)
   1.413 +{ return _empty_wstr; }
   1.414 +const wchar_t* _WLocale_negative_sign(struct _Locale_monetary * lmon,
   1.415 +                                      wchar_t* buf, size_t bufSize)
   1.416 +{ return _empty_wstr; }
   1.417 +#endif
   1.418 +
   1.419 +/* Time */
   1.420 +static const char* full_monthname[] =
   1.421 +{ "January", "February", "March", "April", "May", "June",
   1.422 +  "July", "August", "September", "October", "November", "December" };
   1.423 +const char * _Locale_full_monthname(struct _Locale_time * ltime, int n)
   1.424 +{ return full_monthname[n]; }
   1.425 +
   1.426 +static const char* abbrev_monthname[] =
   1.427 +{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
   1.428 +  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
   1.429 +const char * _Locale_abbrev_monthname(struct _Locale_time * ltime, int n)
   1.430 +{ return abbrev_monthname[n]; }
   1.431 +
   1.432 +static const char* full_dayname[] =
   1.433 +{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
   1.434 +const char * _Locale_full_dayofweek(struct _Locale_time * ltime, int n)
   1.435 +{ return full_dayname[n]; }
   1.436 +
   1.437 +static const char* abbrev_dayname[] =
   1.438 +{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
   1.439 +const char * _Locale_abbrev_dayofweek(struct _Locale_time * ltime, int n)
   1.440 +{ return abbrev_dayname[n]; }
   1.441 +
   1.442 +const char* _Locale_d_t_fmt(struct _Locale_time* ltime)
   1.443 +{ return "%m/%d/%y"; }
   1.444 +const char* _Locale_d_fmt(struct _Locale_time* ltime)
   1.445 +{ return "%m/%d/%y"; }
   1.446 +const char* _Locale_t_fmt(struct _Locale_time* ltime)
   1.447 +{ return "%H:%M:%S"; }
   1.448 +const char* _Locale_long_d_t_fmt(struct _Locale_time* ltime)
   1.449 +{ return _empty_str; }
   1.450 +const char* _Locale_long_d_fmt(struct _Locale_time* ltime)
   1.451 +{ return _empty_str; }
   1.452 +const char* _Locale_am_str(struct _Locale_time* ltime)
   1.453 +{ return "AM"; }
   1.454 +const char* _Locale_pm_str(struct _Locale_time* ltime)
   1.455 +{ return "PM"; }
   1.456 +
   1.457 +#ifndef _STLP_NO_WCHAR_T
   1.458 +#if defined(WCHAR_MAX) && WCHAR_MAX == 255
   1.459 +static const wchar_t* full_wmonthname[] =
   1.460 +{ "January", "February", "March", "April", "May", "June",
   1.461 +  "July", "August", "September", "October", "November", "December" };
   1.462 +const wchar_t * _WLocale_full_monthname(struct _Locale_time * ltime, int n,
   1.463 +                                        wchar_t* buf, size_t bufSize)
   1.464 +{ return full_wmonthname[n]; }
   1.465 +
   1.466 +static const wchar_t* abbrev_wmonthname[] =
   1.467 +{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
   1.468 +  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
   1.469 +const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time * ltime, int n,
   1.470 +                                          wchar_t* buf, size_t bufSize)
   1.471 +{ return abbrev_wmonthname[n]; }
   1.472 +
   1.473 +static const wchar_t* full_wdayname[] =
   1.474 +{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
   1.475 +const wchar_t * _WLocale_full_dayofweek(struct _Locale_time * ltime, int n,
   1.476 +                                        wchar_t* buf, size_t bufSize)
   1.477 +{ return full_wdayname[n]; }
   1.478 +
   1.479 +static const wchar_t* abbrev_wdayname[] =
   1.480 +{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
   1.481 +const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time * ltime, int n,
   1.482 +                                          wchar_t* buf, size_t bufSize)
   1.483 +{ return abbrev_wdayname[n]; }
   1.484 +
   1.485 +const wchar_t* _WLocale_am_str(struct _Locale_time* ltime,
   1.486 +                               wchar_t* buf, size_t bufSize)
   1.487 +{ return "AM"; }
   1.488 +const wchar_t* _WLocale_pm_str(struct _Locale_time* ltime,
   1.489 +                               wchar_t* buf, size_t bufSize)
   1.490 +{ return "PM"; }
   1.491 +#else /* WCHAR_MAX != 255 */
   1.492 +static const wchar_t* full_wmonthname[] =
   1.493 +{ L"January", L"February", L"March", L"April", L"May", L"June",
   1.494 +  L"July", L"August", L"September", L"October", L"November", L"December" };
   1.495 +const wchar_t * _WLocale_full_monthname(struct _Locale_time * ltime, int n,
   1.496 +                                        wchar_t* buf, size_t bufSize)
   1.497 +{ return full_wmonthname[n]; }
   1.498 +
   1.499 +static const wchar_t* abbrev_wmonthname[] =
   1.500 +{ L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
   1.501 +  L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec" };
   1.502 +const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time * ltime, int n,
   1.503 +                                          wchar_t* buf, size_t bufSize)
   1.504 +{ return abbrev_wmonthname[n]; }
   1.505 +
   1.506 +static const wchar_t* full_wdayname[] =
   1.507 +{ L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday", L"Friday", L"Saturday" };
   1.508 +const wchar_t * _WLocale_full_dayofweek(struct _Locale_time * ltime, int n,
   1.509 +                                        wchar_t* buf, size_t bufSize)
   1.510 +{ return full_wdayname[n]; }
   1.511 +
   1.512 +static const wchar_t* abbrev_wdayname[] =
   1.513 +{ L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat" };
   1.514 +const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time * ltime, int n,
   1.515 +                                          wchar_t* buf, size_t bufSize)
   1.516 +{ return abbrev_wdayname[n]; }
   1.517 +
   1.518 +const wchar_t* _WLocale_am_str(struct _Locale_time* ltime,
   1.519 +                               wchar_t* buf, size_t bufSize)
   1.520 +{ return L"AM"; }
   1.521 +const wchar_t* _WLocale_pm_str(struct _Locale_time* ltime,
   1.522 +                               wchar_t* buf, size_t bufSize)
   1.523 +{ return L"PM"; }
   1.524 +#endif /* WCHAR_MAX != 255 */
   1.525 +#endif
   1.526 +
   1.527 +/* Messages */
   1.528 +
   1.529 +nl_catd_type _Locale_catopen(struct _Locale_messages* lmes, const char* name)
   1.530 +{ return -1; }
   1.531 +void _Locale_catclose(struct _Locale_messages* lmes, nl_catd_type cat) {}
   1.532 +const char* _Locale_catgets(struct _Locale_messages* lmes, nl_catd_type cat,
   1.533 +                            int setid, int msgid, const char *dfault)
   1.534 +{ return dfault; }

mercurial