| 1 | --- a/libstdc++-v3/acinclude.m4 |
| 2 | +++ b/libstdc++-v3/acinclude.m4 |
| 3 | @@ -1003,7 +1003,7 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ |
| 4 | AC_MSG_CHECKING([for C locale to use]) |
| 5 | GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], |
| 6 | [use MODEL for target locale package], |
| 7 | - [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) |
| 8 | + [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) |
| 9 | |
| 10 | # If they didn't use this option switch, or if they specified --enable |
| 11 | # with no specific model, we'll have to look for one. If they |
| 12 | @@ -1019,6 +1019,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ |
| 13 | # Default to "generic". |
| 14 | if test $enable_clocale_flag = auto; then |
| 15 | case ${target_os} in |
| 16 | + *-uclibc*) |
| 17 | + enable_clocale_flag=uclibc |
| 18 | + ;; |
| 19 | linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) |
| 20 | AC_EGREP_CPP([_GLIBCXX_ok], [ |
| 21 | #include <features.h> |
| 22 | @@ -1162,6 +1165,40 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ |
| 23 | CTIME_CC=config/locale/generic/time_members.cc |
| 24 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h |
| 25 | ;; |
| 26 | + uclibc) |
| 27 | + AC_MSG_RESULT(uclibc) |
| 28 | + |
| 29 | + # Declare intention to use gettext, and add support for specific |
| 30 | + # languages. |
| 31 | + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT |
| 32 | + ALL_LINGUAS="de fr" |
| 33 | + |
| 34 | + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. |
| 35 | + AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) |
| 36 | + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then |
| 37 | + USE_NLS=yes |
| 38 | + fi |
| 39 | + # Export the build objects. |
| 40 | + for ling in $ALL_LINGUAS; do \ |
| 41 | + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ |
| 42 | + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ |
| 43 | + done |
| 44 | + AC_SUBST(glibcxx_MOFILES) |
| 45 | + AC_SUBST(glibcxx_POFILES) |
| 46 | + |
| 47 | + CLOCALE_H=config/locale/uclibc/c_locale.h |
| 48 | + CLOCALE_CC=config/locale/uclibc/c_locale.cc |
| 49 | + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc |
| 50 | + CCOLLATE_CC=config/locale/uclibc/collate_members.cc |
| 51 | + CCTYPE_CC=config/locale/uclibc/ctype_members.cc |
| 52 | + CMESSAGES_H=config/locale/uclibc/messages_members.h |
| 53 | + CMESSAGES_CC=config/locale/uclibc/messages_members.cc |
| 54 | + CMONEY_CC=config/locale/uclibc/monetary_members.cc |
| 55 | + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc |
| 56 | + CTIME_H=config/locale/uclibc/time_members.h |
| 57 | + CTIME_CC=config/locale/uclibc/time_members.cc |
| 58 | + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h |
| 59 | + ;; |
| 60 | esac |
| 61 | |
| 62 | # This is where the testsuite looks for locale catalogs, using the |
| 63 | --- /dev/null |
| 64 | +++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h |
| 65 | @@ -0,0 +1,63 @@ |
| 66 | +// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- |
| 67 | + |
| 68 | +// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. |
| 69 | +// |
| 70 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 71 | +// software; you can redistribute it and/or modify it under the |
| 72 | +// terms of the GNU General Public License as published by the |
| 73 | +// Free Software Foundation; either version 2, or (at your option) |
| 74 | +// any later version. |
| 75 | + |
| 76 | +// This library is distributed in the hope that it will be useful, |
| 77 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 78 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 79 | +// GNU General Public License for more details. |
| 80 | + |
| 81 | +// You should have received a copy of the GNU General Public License along |
| 82 | +// with this library; see the file COPYING. If not, write to the Free |
| 83 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 84 | +// USA. |
| 85 | + |
| 86 | +// As a special exception, you may use this file as part of a free software |
| 87 | +// library without restriction. Specifically, if other files instantiate |
| 88 | +// templates or use macros or inline functions from this file, or you compile |
| 89 | +// this file and link it with other files to produce an executable, this |
| 90 | +// file does not by itself cause the resulting executable to be covered by |
| 91 | +// the GNU General Public License. This exception does not however |
| 92 | +// invalidate any other reasons why the executable file might be covered by |
| 93 | +// the GNU General Public License. |
| 94 | + |
| 95 | +// Written by Jakub Jelinek <jakub@redhat.com> |
| 96 | + |
| 97 | +#include <bits/c++config.h> |
| 98 | +#include <clocale> |
| 99 | + |
| 100 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 101 | +#warning clean this up |
| 102 | +#endif |
| 103 | + |
| 104 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 105 | + |
| 106 | +extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; |
| 107 | +extern "C" __typeof(strcoll_l) __strcoll_l; |
| 108 | +extern "C" __typeof(strftime_l) __strftime_l; |
| 109 | +extern "C" __typeof(strtod_l) __strtod_l; |
| 110 | +extern "C" __typeof(strtof_l) __strtof_l; |
| 111 | +extern "C" __typeof(strtold_l) __strtold_l; |
| 112 | +extern "C" __typeof(strxfrm_l) __strxfrm_l; |
| 113 | +extern "C" __typeof(newlocale) __newlocale; |
| 114 | +extern "C" __typeof(freelocale) __freelocale; |
| 115 | +extern "C" __typeof(duplocale) __duplocale; |
| 116 | +extern "C" __typeof(uselocale) __uselocale; |
| 117 | + |
| 118 | +#ifdef _GLIBCXX_USE_WCHAR_T |
| 119 | +extern "C" __typeof(iswctype_l) __iswctype_l; |
| 120 | +extern "C" __typeof(towlower_l) __towlower_l; |
| 121 | +extern "C" __typeof(towupper_l) __towupper_l; |
| 122 | +extern "C" __typeof(wcscoll_l) __wcscoll_l; |
| 123 | +extern "C" __typeof(wcsftime_l) __wcsftime_l; |
| 124 | +extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; |
| 125 | +extern "C" __typeof(wctype_l) __wctype_l; |
| 126 | +#endif |
| 127 | + |
| 128 | +#endif // GLIBC 2.3 and later |
| 129 | --- /dev/null |
| 130 | +++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc |
| 131 | @@ -0,0 +1,152 @@ |
| 132 | +// Wrapper for underlying C-language localization -*- C++ -*- |
| 133 | + |
| 134 | +// Copyright (C) 2001, 2002, 2003, 2004, 2005 |
| 135 | +// Free Software Foundation, Inc. |
| 136 | +// |
| 137 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 138 | +// software; you can redistribute it and/or modify it under the |
| 139 | +// terms of the GNU General Public License as published by the |
| 140 | +// Free Software Foundation; either version 2, or (at your option) |
| 141 | +// any later version. |
| 142 | + |
| 143 | +// This library is distributed in the hope that it will be useful, |
| 144 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 145 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 146 | +// GNU General Public License for more details. |
| 147 | + |
| 148 | +// You should have received a copy of the GNU General Public License along |
| 149 | +// with this library; see the file COPYING. If not, write to the Free |
| 150 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 151 | +// USA. |
| 152 | + |
| 153 | +// As a special exception, you may use this file as part of a free software |
| 154 | +// library without restriction. Specifically, if other files instantiate |
| 155 | +// templates or use macros or inline functions from this file, or you compile |
| 156 | +// this file and link it with other files to produce an executable, this |
| 157 | +// file does not by itself cause the resulting executable to be covered by |
| 158 | +// the GNU General Public License. This exception does not however |
| 159 | +// invalidate any other reasons why the executable file might be covered by |
| 160 | +// the GNU General Public License. |
| 161 | + |
| 162 | +// |
| 163 | +// ISO C++ 14882: 22.8 Standard locale categories. |
| 164 | +// |
| 165 | + |
| 166 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 167 | + |
| 168 | +#include <cerrno> // For errno |
| 169 | +#include <locale> |
| 170 | +#include <stdexcept> |
| 171 | +#include <langinfo.h> |
| 172 | +#include <bits/c++locale_internal.h> |
| 173 | + |
| 174 | +#ifndef __UCLIBC_HAS_XLOCALE__ |
| 175 | +#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) |
| 176 | +#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) |
| 177 | +#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) |
| 178 | +#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) |
| 179 | +#define __strtof_l(S, E, L) strtof((S), (E)) |
| 180 | +#define __strtod_l(S, E, L) strtod((S), (E)) |
| 181 | +#define __strtold_l(S, E, L) strtold((S), (E)) |
| 182 | +#warning should dummy __newlocale check for C|POSIX ? |
| 183 | +#define __newlocale(a, b, c) NULL |
| 184 | +#define __freelocale(a) ((void)0) |
| 185 | +#define __duplocale(a) __c_locale() |
| 186 | +#endif |
| 187 | + |
| 188 | +namespace std |
| 189 | +{ |
| 190 | + template<> |
| 191 | + void |
| 192 | + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, |
| 193 | + const __c_locale& __cloc) |
| 194 | + { |
| 195 | + char* __sanity; |
| 196 | + errno = 0; |
| 197 | + float __f = __strtof_l(__s, &__sanity, __cloc); |
| 198 | + if (__sanity != __s && errno != ERANGE) |
| 199 | + __v = __f; |
| 200 | + else |
| 201 | + __err |= ios_base::failbit; |
| 202 | + } |
| 203 | + |
| 204 | + template<> |
| 205 | + void |
| 206 | + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, |
| 207 | + const __c_locale& __cloc) |
| 208 | + { |
| 209 | + char* __sanity; |
| 210 | + errno = 0; |
| 211 | + double __d = __strtod_l(__s, &__sanity, __cloc); |
| 212 | + if (__sanity != __s && errno != ERANGE) |
| 213 | + __v = __d; |
| 214 | + else |
| 215 | + __err |= ios_base::failbit; |
| 216 | + } |
| 217 | + |
| 218 | + template<> |
| 219 | + void |
| 220 | + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, |
| 221 | + const __c_locale& __cloc) |
| 222 | + { |
| 223 | + char* __sanity; |
| 224 | + errno = 0; |
| 225 | + long double __ld = __strtold_l(__s, &__sanity, __cloc); |
| 226 | + if (__sanity != __s && errno != ERANGE) |
| 227 | + __v = __ld; |
| 228 | + else |
| 229 | + __err |= ios_base::failbit; |
| 230 | + } |
| 231 | + |
| 232 | + void |
| 233 | + locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, |
| 234 | + __c_locale __old) |
| 235 | + { |
| 236 | + __cloc = __newlocale(1 << LC_ALL, __s, __old); |
| 237 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 238 | + if (!__cloc) |
| 239 | + { |
| 240 | + // This named locale is not supported by the underlying OS. |
| 241 | + __throw_runtime_error(__N("locale::facet::_S_create_c_locale " |
| 242 | + "name not valid")); |
| 243 | + } |
| 244 | +#endif |
| 245 | + } |
| 246 | + |
| 247 | + void |
| 248 | + locale::facet::_S_destroy_c_locale(__c_locale& __cloc) |
| 249 | + { |
| 250 | + if (__cloc && _S_get_c_locale() != __cloc) |
| 251 | + __freelocale(__cloc); |
| 252 | + } |
| 253 | + |
| 254 | + __c_locale |
| 255 | + locale::facet::_S_clone_c_locale(__c_locale& __cloc) |
| 256 | + { return __duplocale(__cloc); } |
| 257 | +} // namespace std |
| 258 | + |
| 259 | +namespace __gnu_cxx |
| 260 | +{ |
| 261 | + const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = |
| 262 | + { |
| 263 | + "LC_CTYPE", |
| 264 | + "LC_NUMERIC", |
| 265 | + "LC_TIME", |
| 266 | + "LC_COLLATE", |
| 267 | + "LC_MONETARY", |
| 268 | + "LC_MESSAGES", |
| 269 | +#if _GLIBCXX_NUM_CATEGORIES != 0 |
| 270 | + "LC_PAPER", |
| 271 | + "LC_NAME", |
| 272 | + "LC_ADDRESS", |
| 273 | + "LC_TELEPHONE", |
| 274 | + "LC_MEASUREMENT", |
| 275 | + "LC_IDENTIFICATION" |
| 276 | +#endif |
| 277 | + }; |
| 278 | +} |
| 279 | + |
| 280 | +namespace std |
| 281 | +{ |
| 282 | + const char* const* const locale::_S_categories = __gnu_cxx::category_names; |
| 283 | +} // namespace std |
| 284 | --- /dev/null |
| 285 | +++ b/libstdc++-v3/config/locale/uclibc/c_locale.h |
| 286 | @@ -0,0 +1,117 @@ |
| 287 | +// Wrapper for underlying C-language localization -*- C++ -*- |
| 288 | + |
| 289 | +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 290 | +// |
| 291 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 292 | +// software; you can redistribute it and/or modify it under the |
| 293 | +// terms of the GNU General Public License as published by the |
| 294 | +// Free Software Foundation; either version 2, or (at your option) |
| 295 | +// any later version. |
| 296 | + |
| 297 | +// This library is distributed in the hope that it will be useful, |
| 298 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 299 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 300 | +// GNU General Public License for more details. |
| 301 | + |
| 302 | +// You should have received a copy of the GNU General Public License along |
| 303 | +// with this library; see the file COPYING. If not, write to the Free |
| 304 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 305 | +// USA. |
| 306 | + |
| 307 | +// As a special exception, you may use this file as part of a free software |
| 308 | +// library without restriction. Specifically, if other files instantiate |
| 309 | +// templates or use macros or inline functions from this file, or you compile |
| 310 | +// this file and link it with other files to produce an executable, this |
| 311 | +// file does not by itself cause the resulting executable to be covered by |
| 312 | +// the GNU General Public License. This exception does not however |
| 313 | +// invalidate any other reasons why the executable file might be covered by |
| 314 | +// the GNU General Public License. |
| 315 | + |
| 316 | +// |
| 317 | +// ISO C++ 14882: 22.8 Standard locale categories. |
| 318 | +// |
| 319 | + |
| 320 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 321 | + |
| 322 | +#ifndef _C_LOCALE_H |
| 323 | +#define _C_LOCALE_H 1 |
| 324 | + |
| 325 | +#pragma GCC system_header |
| 326 | + |
| 327 | +#include <cstring> // get std::strlen |
| 328 | +#include <cstdio> // get std::snprintf or std::sprintf |
| 329 | +#include <clocale> |
| 330 | +#include <langinfo.h> // For codecvt |
| 331 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 332 | +#warning fix this |
| 333 | +#endif |
| 334 | +#ifdef __UCLIBC_HAS_LOCALE__ |
| 335 | +#include <iconv.h> // For codecvt using iconv, iconv_t |
| 336 | +#endif |
| 337 | +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ |
| 338 | +#include <libintl.h> // For messages |
| 339 | +#endif |
| 340 | + |
| 341 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 342 | +#warning what is _GLIBCXX_C_LOCALE_GNU for |
| 343 | +#endif |
| 344 | +#define _GLIBCXX_C_LOCALE_GNU 1 |
| 345 | + |
| 346 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 347 | +#warning fix categories |
| 348 | +#endif |
| 349 | +// #define _GLIBCXX_NUM_CATEGORIES 6 |
| 350 | +#define _GLIBCXX_NUM_CATEGORIES 0 |
| 351 | + |
| 352 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 353 | +namespace __gnu_cxx |
| 354 | +{ |
| 355 | + extern "C" __typeof(uselocale) __uselocale; |
| 356 | +} |
| 357 | +#endif |
| 358 | + |
| 359 | +namespace std |
| 360 | +{ |
| 361 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 362 | + typedef __locale_t __c_locale; |
| 363 | +#else |
| 364 | + typedef int* __c_locale; |
| 365 | +#endif |
| 366 | + |
| 367 | + // Convert numeric value of type _Tv to string and return length of |
| 368 | + // string. If snprintf is available use it, otherwise fall back to |
| 369 | + // the unsafe sprintf which, in general, can be dangerous and should |
| 370 | + // be avoided. |
| 371 | + template<typename _Tv> |
| 372 | + int |
| 373 | + __convert_from_v(char* __out, |
| 374 | + const int __size __attribute__ ((__unused__)), |
| 375 | + const char* __fmt, |
| 376 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 377 | + _Tv __v, const __c_locale& __cloc, int __prec) |
| 378 | + { |
| 379 | + __c_locale __old = __gnu_cxx::__uselocale(__cloc); |
| 380 | +#else |
| 381 | + _Tv __v, const __c_locale&, int __prec) |
| 382 | + { |
| 383 | +# ifdef __UCLIBC_HAS_LOCALE__ |
| 384 | + char* __old = std::setlocale(LC_ALL, NULL); |
| 385 | + char* __sav = new char[std::strlen(__old) + 1]; |
| 386 | + std::strcpy(__sav, __old); |
| 387 | + std::setlocale(LC_ALL, "C"); |
| 388 | +# endif |
| 389 | +#endif |
| 390 | + |
| 391 | + const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); |
| 392 | + |
| 393 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 394 | + __gnu_cxx::__uselocale(__old); |
| 395 | +#elif defined __UCLIBC_HAS_LOCALE__ |
| 396 | + std::setlocale(LC_ALL, __sav); |
| 397 | + delete [] __sav; |
| 398 | +#endif |
| 399 | + return __ret; |
| 400 | + } |
| 401 | +} |
| 402 | + |
| 403 | +#endif |
| 404 | --- /dev/null |
| 405 | +++ b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc |
| 406 | @@ -0,0 +1,306 @@ |
| 407 | +// std::codecvt implementation details, GNU version -*- C++ -*- |
| 408 | + |
| 409 | +// Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
| 410 | +// |
| 411 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 412 | +// software; you can redistribute it and/or modify it under the |
| 413 | +// terms of the GNU General Public License as published by the |
| 414 | +// Free Software Foundation; either version 2, or (at your option) |
| 415 | +// any later version. |
| 416 | + |
| 417 | +// This library is distributed in the hope that it will be useful, |
| 418 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 419 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 420 | +// GNU General Public License for more details. |
| 421 | + |
| 422 | +// You should have received a copy of the GNU General Public License along |
| 423 | +// with this library; see the file COPYING. If not, write to the Free |
| 424 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 425 | +// USA. |
| 426 | + |
| 427 | +// As a special exception, you may use this file as part of a free software |
| 428 | +// library without restriction. Specifically, if other files instantiate |
| 429 | +// templates or use macros or inline functions from this file, or you compile |
| 430 | +// this file and link it with other files to produce an executable, this |
| 431 | +// file does not by itself cause the resulting executable to be covered by |
| 432 | +// the GNU General Public License. This exception does not however |
| 433 | +// invalidate any other reasons why the executable file might be covered by |
| 434 | +// the GNU General Public License. |
| 435 | + |
| 436 | +// |
| 437 | +// ISO C++ 14882: 22.2.1.5 - Template class codecvt |
| 438 | +// |
| 439 | + |
| 440 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 441 | + |
| 442 | +#include <locale> |
| 443 | +#include <bits/c++locale_internal.h> |
| 444 | + |
| 445 | +namespace std |
| 446 | +{ |
| 447 | + // Specializations. |
| 448 | +#ifdef _GLIBCXX_USE_WCHAR_T |
| 449 | + codecvt_base::result |
| 450 | + codecvt<wchar_t, char, mbstate_t>:: |
| 451 | + do_out(state_type& __state, const intern_type* __from, |
| 452 | + const intern_type* __from_end, const intern_type*& __from_next, |
| 453 | + extern_type* __to, extern_type* __to_end, |
| 454 | + extern_type*& __to_next) const |
| 455 | + { |
| 456 | + result __ret = ok; |
| 457 | + state_type __tmp_state(__state); |
| 458 | + |
| 459 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 460 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); |
| 461 | +#endif |
| 462 | + |
| 463 | + // wcsnrtombs is *very* fast but stops if encounters NUL characters: |
| 464 | + // in case we fall back to wcrtomb and then continue, in a loop. |
| 465 | + // NB: wcsnrtombs is a GNU extension |
| 466 | + for (__from_next = __from, __to_next = __to; |
| 467 | + __from_next < __from_end && __to_next < __to_end |
| 468 | + && __ret == ok;) |
| 469 | + { |
| 470 | + const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0', |
| 471 | + __from_end - __from_next); |
| 472 | + if (!__from_chunk_end) |
| 473 | + __from_chunk_end = __from_end; |
| 474 | + |
| 475 | + __from = __from_next; |
| 476 | + const size_t __conv = wcsnrtombs(__to_next, &__from_next, |
| 477 | + __from_chunk_end - __from_next, |
| 478 | + __to_end - __to_next, &__state); |
| 479 | + if (__conv == static_cast<size_t>(-1)) |
| 480 | + { |
| 481 | + // In case of error, in order to stop at the exact place we |
| 482 | + // have to start again from the beginning with a series of |
| 483 | + // wcrtomb. |
| 484 | + for (; __from < __from_next; ++__from) |
| 485 | + __to_next += wcrtomb(__to_next, *__from, &__tmp_state); |
| 486 | + __state = __tmp_state; |
| 487 | + __ret = error; |
| 488 | + } |
| 489 | + else if (__from_next && __from_next < __from_chunk_end) |
| 490 | + { |
| 491 | + __to_next += __conv; |
| 492 | + __ret = partial; |
| 493 | + } |
| 494 | + else |
| 495 | + { |
| 496 | + __from_next = __from_chunk_end; |
| 497 | + __to_next += __conv; |
| 498 | + } |
| 499 | + |
| 500 | + if (__from_next < __from_end && __ret == ok) |
| 501 | + { |
| 502 | + extern_type __buf[MB_LEN_MAX]; |
| 503 | + __tmp_state = __state; |
| 504 | + const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state); |
| 505 | + if (__conv > static_cast<size_t>(__to_end - __to_next)) |
| 506 | + __ret = partial; |
| 507 | + else |
| 508 | + { |
| 509 | + memcpy(__to_next, __buf, __conv); |
| 510 | + __state = __tmp_state; |
| 511 | + __to_next += __conv; |
| 512 | + ++__from_next; |
| 513 | + } |
| 514 | + } |
| 515 | + } |
| 516 | + |
| 517 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 518 | + __uselocale(__old); |
| 519 | +#endif |
| 520 | + |
| 521 | + return __ret; |
| 522 | + } |
| 523 | + |
| 524 | + codecvt_base::result |
| 525 | + codecvt<wchar_t, char, mbstate_t>:: |
| 526 | + do_in(state_type& __state, const extern_type* __from, |
| 527 | + const extern_type* __from_end, const extern_type*& __from_next, |
| 528 | + intern_type* __to, intern_type* __to_end, |
| 529 | + intern_type*& __to_next) const |
| 530 | + { |
| 531 | + result __ret = ok; |
| 532 | + state_type __tmp_state(__state); |
| 533 | + |
| 534 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 535 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); |
| 536 | +#endif |
| 537 | + |
| 538 | + // mbsnrtowcs is *very* fast but stops if encounters NUL characters: |
| 539 | + // in case we store a L'\0' and then continue, in a loop. |
| 540 | + // NB: mbsnrtowcs is a GNU extension |
| 541 | + for (__from_next = __from, __to_next = __to; |
| 542 | + __from_next < __from_end && __to_next < __to_end |
| 543 | + && __ret == ok;) |
| 544 | + { |
| 545 | + const extern_type* __from_chunk_end; |
| 546 | + __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0', |
| 547 | + __from_end |
| 548 | + - __from_next)); |
| 549 | + if (!__from_chunk_end) |
| 550 | + __from_chunk_end = __from_end; |
| 551 | + |
| 552 | + __from = __from_next; |
| 553 | + size_t __conv = mbsnrtowcs(__to_next, &__from_next, |
| 554 | + __from_chunk_end - __from_next, |
| 555 | + __to_end - __to_next, &__state); |
| 556 | + if (__conv == static_cast<size_t>(-1)) |
| 557 | + { |
| 558 | + // In case of error, in order to stop at the exact place we |
| 559 | + // have to start again from the beginning with a series of |
| 560 | + // mbrtowc. |
| 561 | + for (;; ++__to_next, __from += __conv) |
| 562 | + { |
| 563 | + __conv = mbrtowc(__to_next, __from, __from_end - __from, |
| 564 | + &__tmp_state); |
| 565 | + if (__conv == static_cast<size_t>(-1) |
| 566 | + || __conv == static_cast<size_t>(-2)) |
| 567 | + break; |
| 568 | + } |
| 569 | + __from_next = __from; |
| 570 | + __state = __tmp_state; |
| 571 | + __ret = error; |
| 572 | + } |
| 573 | + else if (__from_next && __from_next < __from_chunk_end) |
| 574 | + { |
| 575 | + // It is unclear what to return in this case (see DR 382). |
| 576 | + __to_next += __conv; |
| 577 | + __ret = partial; |
| 578 | + } |
| 579 | + else |
| 580 | + { |
| 581 | + __from_next = __from_chunk_end; |
| 582 | + __to_next += __conv; |
| 583 | + } |
| 584 | + |
| 585 | + if (__from_next < __from_end && __ret == ok) |
| 586 | + { |
| 587 | + if (__to_next < __to_end) |
| 588 | + { |
| 589 | + // XXX Probably wrong for stateful encodings |
| 590 | + __tmp_state = __state; |
| 591 | + ++__from_next; |
| 592 | + *__to_next++ = L'\0'; |
| 593 | + } |
| 594 | + else |
| 595 | + __ret = partial; |
| 596 | + } |
| 597 | + } |
| 598 | + |
| 599 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 600 | + __uselocale(__old); |
| 601 | +#endif |
| 602 | + |
| 603 | + return __ret; |
| 604 | + } |
| 605 | + |
| 606 | + int |
| 607 | + codecvt<wchar_t, char, mbstate_t>:: |
| 608 | + do_encoding() const throw() |
| 609 | + { |
| 610 | + // XXX This implementation assumes that the encoding is |
| 611 | + // stateless and is either single-byte or variable-width. |
| 612 | + int __ret = 0; |
| 613 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 614 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); |
| 615 | +#endif |
| 616 | + if (MB_CUR_MAX == 1) |
| 617 | + __ret = 1; |
| 618 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 619 | + __uselocale(__old); |
| 620 | +#endif |
| 621 | + return __ret; |
| 622 | + } |
| 623 | + |
| 624 | + int |
| 625 | + codecvt<wchar_t, char, mbstate_t>:: |
| 626 | + do_max_length() const throw() |
| 627 | + { |
| 628 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 629 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); |
| 630 | +#endif |
| 631 | + // XXX Probably wrong for stateful encodings. |
| 632 | + int __ret = MB_CUR_MAX; |
| 633 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 634 | + __uselocale(__old); |
| 635 | +#endif |
| 636 | + return __ret; |
| 637 | + } |
| 638 | + |
| 639 | + int |
| 640 | + codecvt<wchar_t, char, mbstate_t>:: |
| 641 | + do_length(state_type& __state, const extern_type* __from, |
| 642 | + const extern_type* __end, size_t __max) const |
| 643 | + { |
| 644 | + int __ret = 0; |
| 645 | + state_type __tmp_state(__state); |
| 646 | + |
| 647 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 648 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); |
| 649 | +#endif |
| 650 | + |
| 651 | + // mbsnrtowcs is *very* fast but stops if encounters NUL characters: |
| 652 | + // in case we advance past it and then continue, in a loop. |
| 653 | + // NB: mbsnrtowcs is a GNU extension |
| 654 | + |
| 655 | + // A dummy internal buffer is needed in order for mbsnrtocws to consider |
| 656 | + // its fourth parameter (it wouldn't with NULL as first parameter). |
| 657 | + wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t) |
| 658 | + * __max)); |
| 659 | + while (__from < __end && __max) |
| 660 | + { |
| 661 | + const extern_type* __from_chunk_end; |
| 662 | + __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0', |
| 663 | + __end |
| 664 | + - __from)); |
| 665 | + if (!__from_chunk_end) |
| 666 | + __from_chunk_end = __end; |
| 667 | + |
| 668 | + const extern_type* __tmp_from = __from; |
| 669 | + size_t __conv = mbsnrtowcs(__to, &__from, |
| 670 | + __from_chunk_end - __from, |
| 671 | + __max, &__state); |
| 672 | + if (__conv == static_cast<size_t>(-1)) |
| 673 | + { |
| 674 | + // In case of error, in order to stop at the exact place we |
| 675 | + // have to start again from the beginning with a series of |
| 676 | + // mbrtowc. |
| 677 | + for (__from = __tmp_from;; __from += __conv) |
| 678 | + { |
| 679 | + __conv = mbrtowc(NULL, __from, __end - __from, |
| 680 | + &__tmp_state); |
| 681 | + if (__conv == static_cast<size_t>(-1) |
| 682 | + || __conv == static_cast<size_t>(-2)) |
| 683 | + break; |
| 684 | + } |
| 685 | + __state = __tmp_state; |
| 686 | + __ret += __from - __tmp_from; |
| 687 | + break; |
| 688 | + } |
| 689 | + if (!__from) |
| 690 | + __from = __from_chunk_end; |
| 691 | + |
| 692 | + __ret += __from - __tmp_from; |
| 693 | + __max -= __conv; |
| 694 | + |
| 695 | + if (__from < __end && __max) |
| 696 | + { |
| 697 | + // XXX Probably wrong for stateful encodings |
| 698 | + __tmp_state = __state; |
| 699 | + ++__from; |
| 700 | + ++__ret; |
| 701 | + --__max; |
| 702 | + } |
| 703 | + } |
| 704 | + |
| 705 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 706 | + __uselocale(__old); |
| 707 | +#endif |
| 708 | + |
| 709 | + return __ret; |
| 710 | + } |
| 711 | +#endif |
| 712 | +} |
| 713 | --- /dev/null |
| 714 | +++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc |
| 715 | @@ -0,0 +1,80 @@ |
| 716 | +// std::collate implementation details, GNU version -*- C++ -*- |
| 717 | + |
| 718 | +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. |
| 719 | +// |
| 720 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 721 | +// software; you can redistribute it and/or modify it under the |
| 722 | +// terms of the GNU General Public License as published by the |
| 723 | +// Free Software Foundation; either version 2, or (at your option) |
| 724 | +// any later version. |
| 725 | + |
| 726 | +// This library is distributed in the hope that it will be useful, |
| 727 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 728 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 729 | +// GNU General Public License for more details. |
| 730 | + |
| 731 | +// You should have received a copy of the GNU General Public License along |
| 732 | +// with this library; see the file COPYING. If not, write to the Free |
| 733 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 734 | +// USA. |
| 735 | + |
| 736 | +// As a special exception, you may use this file as part of a free software |
| 737 | +// library without restriction. Specifically, if other files instantiate |
| 738 | +// templates or use macros or inline functions from this file, or you compile |
| 739 | +// this file and link it with other files to produce an executable, this |
| 740 | +// file does not by itself cause the resulting executable to be covered by |
| 741 | +// the GNU General Public License. This exception does not however |
| 742 | +// invalidate any other reasons why the executable file might be covered by |
| 743 | +// the GNU General Public License. |
| 744 | + |
| 745 | +// |
| 746 | +// ISO C++ 14882: 22.2.4.1.2 collate virtual functions |
| 747 | +// |
| 748 | + |
| 749 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 750 | + |
| 751 | +#include <locale> |
| 752 | +#include <bits/c++locale_internal.h> |
| 753 | + |
| 754 | +#ifndef __UCLIBC_HAS_XLOCALE__ |
| 755 | +#define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) |
| 756 | +#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) |
| 757 | +#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) |
| 758 | +#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) |
| 759 | +#endif |
| 760 | + |
| 761 | +namespace std |
| 762 | +{ |
| 763 | + // These are basically extensions to char_traits, and perhaps should |
| 764 | + // be put there instead of here. |
| 765 | + template<> |
| 766 | + int |
| 767 | + collate<char>::_M_compare(const char* __one, const char* __two) const |
| 768 | + { |
| 769 | + int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); |
| 770 | + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); |
| 771 | + } |
| 772 | + |
| 773 | + template<> |
| 774 | + size_t |
| 775 | + collate<char>::_M_transform(char* __to, const char* __from, |
| 776 | + size_t __n) const |
| 777 | + { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } |
| 778 | + |
| 779 | +#ifdef _GLIBCXX_USE_WCHAR_T |
| 780 | + template<> |
| 781 | + int |
| 782 | + collate<wchar_t>::_M_compare(const wchar_t* __one, |
| 783 | + const wchar_t* __two) const |
| 784 | + { |
| 785 | + int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); |
| 786 | + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); |
| 787 | + } |
| 788 | + |
| 789 | + template<> |
| 790 | + size_t |
| 791 | + collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from, |
| 792 | + size_t __n) const |
| 793 | + { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } |
| 794 | +#endif |
| 795 | +} |
| 796 | --- /dev/null |
| 797 | +++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc |
| 798 | @@ -0,0 +1,314 @@ |
| 799 | +// std::ctype implementation details, GNU version -*- C++ -*- |
| 800 | + |
| 801 | +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
| 802 | +// |
| 803 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 804 | +// software; you can redistribute it and/or modify it under the |
| 805 | +// terms of the GNU General Public License as published by the |
| 806 | +// Free Software Foundation; either version 2, or (at your option) |
| 807 | +// any later version. |
| 808 | + |
| 809 | +// This library is distributed in the hope that it will be useful, |
| 810 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 811 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 812 | +// GNU General Public License for more details. |
| 813 | + |
| 814 | +// You should have received a copy of the GNU General Public License along |
| 815 | +// with this library; see the file COPYING. If not, write to the Free |
| 816 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 817 | +// USA. |
| 818 | + |
| 819 | +// As a special exception, you may use this file as part of a free software |
| 820 | +// library without restriction. Specifically, if other files instantiate |
| 821 | +// templates or use macros or inline functions from this file, or you compile |
| 822 | +// this file and link it with other files to produce an executable, this |
| 823 | +// file does not by itself cause the resulting executable to be covered by |
| 824 | +// the GNU General Public License. This exception does not however |
| 825 | +// invalidate any other reasons why the executable file might be covered by |
| 826 | +// the GNU General Public License. |
| 827 | + |
| 828 | +// |
| 829 | +// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. |
| 830 | +// |
| 831 | + |
| 832 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 833 | + |
| 834 | +#define _LIBC |
| 835 | +#include <locale> |
| 836 | +#undef _LIBC |
| 837 | +#include <bits/c++locale_internal.h> |
| 838 | + |
| 839 | +#ifndef __UCLIBC_HAS_XLOCALE__ |
| 840 | +#define __wctype_l(S, L) wctype((S)) |
| 841 | +#define __towupper_l(C, L) towupper((C)) |
| 842 | +#define __towlower_l(C, L) towlower((C)) |
| 843 | +#define __iswctype_l(C, M, L) iswctype((C), (M)) |
| 844 | +#endif |
| 845 | + |
| 846 | +namespace std |
| 847 | +{ |
| 848 | + // NB: The other ctype<char> specializations are in src/locale.cc and |
| 849 | + // various /config/os/* files. |
| 850 | + template<> |
| 851 | + ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) |
| 852 | + : ctype<char>(0, false, __refs) |
| 853 | + { |
| 854 | + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) |
| 855 | + { |
| 856 | + this->_S_destroy_c_locale(this->_M_c_locale_ctype); |
| 857 | + this->_S_create_c_locale(this->_M_c_locale_ctype, __s); |
| 858 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 859 | + this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper; |
| 860 | + this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower; |
| 861 | + this->_M_table = this->_M_c_locale_ctype->__ctype_b; |
| 862 | +#endif |
| 863 | + } |
| 864 | + } |
| 865 | + |
| 866 | +#ifdef _GLIBCXX_USE_WCHAR_T |
| 867 | + ctype<wchar_t>::__wmask_type |
| 868 | + ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const |
| 869 | + { |
| 870 | + __wmask_type __ret; |
| 871 | + switch (__m) |
| 872 | + { |
| 873 | + case space: |
| 874 | + __ret = __wctype_l("space", _M_c_locale_ctype); |
| 875 | + break; |
| 876 | + case print: |
| 877 | + __ret = __wctype_l("print", _M_c_locale_ctype); |
| 878 | + break; |
| 879 | + case cntrl: |
| 880 | + __ret = __wctype_l("cntrl", _M_c_locale_ctype); |
| 881 | + break; |
| 882 | + case upper: |
| 883 | + __ret = __wctype_l("upper", _M_c_locale_ctype); |
| 884 | + break; |
| 885 | + case lower: |
| 886 | + __ret = __wctype_l("lower", _M_c_locale_ctype); |
| 887 | + break; |
| 888 | + case alpha: |
| 889 | + __ret = __wctype_l("alpha", _M_c_locale_ctype); |
| 890 | + break; |
| 891 | + case digit: |
| 892 | + __ret = __wctype_l("digit", _M_c_locale_ctype); |
| 893 | + break; |
| 894 | + case punct: |
| 895 | + __ret = __wctype_l("punct", _M_c_locale_ctype); |
| 896 | + break; |
| 897 | + case xdigit: |
| 898 | + __ret = __wctype_l("xdigit", _M_c_locale_ctype); |
| 899 | + break; |
| 900 | + case alnum: |
| 901 | + __ret = __wctype_l("alnum", _M_c_locale_ctype); |
| 902 | + break; |
| 903 | + case graph: |
| 904 | + __ret = __wctype_l("graph", _M_c_locale_ctype); |
| 905 | + break; |
| 906 | + default: |
| 907 | + __ret = __wmask_type(); |
| 908 | + } |
| 909 | + return __ret; |
| 910 | + } |
| 911 | + |
| 912 | + wchar_t |
| 913 | + ctype<wchar_t>::do_toupper(wchar_t __c) const |
| 914 | + { return __towupper_l(__c, _M_c_locale_ctype); } |
| 915 | + |
| 916 | + const wchar_t* |
| 917 | + ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const |
| 918 | + { |
| 919 | + while (__lo < __hi) |
| 920 | + { |
| 921 | + *__lo = __towupper_l(*__lo, _M_c_locale_ctype); |
| 922 | + ++__lo; |
| 923 | + } |
| 924 | + return __hi; |
| 925 | + } |
| 926 | + |
| 927 | + wchar_t |
| 928 | + ctype<wchar_t>::do_tolower(wchar_t __c) const |
| 929 | + { return __towlower_l(__c, _M_c_locale_ctype); } |
| 930 | + |
| 931 | + const wchar_t* |
| 932 | + ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const |
| 933 | + { |
| 934 | + while (__lo < __hi) |
| 935 | + { |
| 936 | + *__lo = __towlower_l(*__lo, _M_c_locale_ctype); |
| 937 | + ++__lo; |
| 938 | + } |
| 939 | + return __hi; |
| 940 | + } |
| 941 | + |
| 942 | + bool |
| 943 | + ctype<wchar_t>:: |
| 944 | + do_is(mask __m, wchar_t __c) const |
| 945 | + { |
| 946 | + // The case of __m == ctype_base::space is particularly important, |
| 947 | + // due to its use in many istream functions. Therefore we deal with |
| 948 | + // it first, exploiting the knowledge that on GNU systems _M_bit[5] |
| 949 | + // is the mask corresponding to ctype_base::space. NB: an encoding |
| 950 | + // change would not affect correctness! |
| 951 | + bool __ret = false; |
| 952 | + if (__m == _M_bit[5]) |
| 953 | + __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype); |
| 954 | + else |
| 955 | + { |
| 956 | + // Highest bitmask in ctype_base == 10, but extra in "C" |
| 957 | + // library for blank. |
| 958 | + const size_t __bitmasksize = 11; |
| 959 | + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) |
| 960 | + if (__m & _M_bit[__bitcur]) |
| 961 | + { |
| 962 | + if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) |
| 963 | + { |
| 964 | + __ret = true; |
| 965 | + break; |
| 966 | + } |
| 967 | + else if (__m == _M_bit[__bitcur]) |
| 968 | + break; |
| 969 | + } |
| 970 | + } |
| 971 | + return __ret; |
| 972 | + } |
| 973 | + |
| 974 | + const wchar_t* |
| 975 | + ctype<wchar_t>:: |
| 976 | + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const |
| 977 | + { |
| 978 | + for (; __lo < __hi; ++__vec, ++__lo) |
| 979 | + { |
| 980 | + // Highest bitmask in ctype_base == 10, but extra in "C" |
| 981 | + // library for blank. |
| 982 | + const size_t __bitmasksize = 11; |
| 983 | + mask __m = 0; |
| 984 | + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) |
| 985 | + if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype)) |
| 986 | + __m |= _M_bit[__bitcur]; |
| 987 | + *__vec = __m; |
| 988 | + } |
| 989 | + return __hi; |
| 990 | + } |
| 991 | + |
| 992 | + const wchar_t* |
| 993 | + ctype<wchar_t>:: |
| 994 | + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const |
| 995 | + { |
| 996 | + while (__lo < __hi && !this->do_is(__m, *__lo)) |
| 997 | + ++__lo; |
| 998 | + return __lo; |
| 999 | + } |
| 1000 | + |
| 1001 | + const wchar_t* |
| 1002 | + ctype<wchar_t>:: |
| 1003 | + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const |
| 1004 | + { |
| 1005 | + while (__lo < __hi && this->do_is(__m, *__lo) != 0) |
| 1006 | + ++__lo; |
| 1007 | + return __lo; |
| 1008 | + } |
| 1009 | + |
| 1010 | + wchar_t |
| 1011 | + ctype<wchar_t>:: |
| 1012 | + do_widen(char __c) const |
| 1013 | + { return _M_widen[static_cast<unsigned char>(__c)]; } |
| 1014 | + |
| 1015 | + const char* |
| 1016 | + ctype<wchar_t>:: |
| 1017 | + do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const |
| 1018 | + { |
| 1019 | + while (__lo < __hi) |
| 1020 | + { |
| 1021 | + *__dest = _M_widen[static_cast<unsigned char>(*__lo)]; |
| 1022 | + ++__lo; |
| 1023 | + ++__dest; |
| 1024 | + } |
| 1025 | + return __hi; |
| 1026 | + } |
| 1027 | + |
| 1028 | + char |
| 1029 | + ctype<wchar_t>:: |
| 1030 | + do_narrow(wchar_t __wc, char __dfault) const |
| 1031 | + { |
| 1032 | + if (__wc >= 0 && __wc < 128 && _M_narrow_ok) |
| 1033 | + return _M_narrow[__wc]; |
| 1034 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1035 | + __c_locale __old = __uselocale(_M_c_locale_ctype); |
| 1036 | +#endif |
| 1037 | + const int __c = wctob(__wc); |
| 1038 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1039 | + __uselocale(__old); |
| 1040 | +#endif |
| 1041 | + return (__c == EOF ? __dfault : static_cast<char>(__c)); |
| 1042 | + } |
| 1043 | + |
| 1044 | + const wchar_t* |
| 1045 | + ctype<wchar_t>:: |
| 1046 | + do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, |
| 1047 | + char* __dest) const |
| 1048 | + { |
| 1049 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1050 | + __c_locale __old = __uselocale(_M_c_locale_ctype); |
| 1051 | +#endif |
| 1052 | + if (_M_narrow_ok) |
| 1053 | + while (__lo < __hi) |
| 1054 | + { |
| 1055 | + if (*__lo >= 0 && *__lo < 128) |
| 1056 | + *__dest = _M_narrow[*__lo]; |
| 1057 | + else |
| 1058 | + { |
| 1059 | + const int __c = wctob(*__lo); |
| 1060 | + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); |
| 1061 | + } |
| 1062 | + ++__lo; |
| 1063 | + ++__dest; |
| 1064 | + } |
| 1065 | + else |
| 1066 | + while (__lo < __hi) |
| 1067 | + { |
| 1068 | + const int __c = wctob(*__lo); |
| 1069 | + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); |
| 1070 | + ++__lo; |
| 1071 | + ++__dest; |
| 1072 | + } |
| 1073 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1074 | + __uselocale(__old); |
| 1075 | +#endif |
| 1076 | + return __hi; |
| 1077 | + } |
| 1078 | + |
| 1079 | + void |
| 1080 | + ctype<wchar_t>::_M_initialize_ctype() |
| 1081 | + { |
| 1082 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1083 | + __c_locale __old = __uselocale(_M_c_locale_ctype); |
| 1084 | +#endif |
| 1085 | + wint_t __i; |
| 1086 | + for (__i = 0; __i < 128; ++__i) |
| 1087 | + { |
| 1088 | + const int __c = wctob(__i); |
| 1089 | + if (__c == EOF) |
| 1090 | + break; |
| 1091 | + else |
| 1092 | + _M_narrow[__i] = static_cast<char>(__c); |
| 1093 | + } |
| 1094 | + if (__i == 128) |
| 1095 | + _M_narrow_ok = true; |
| 1096 | + else |
| 1097 | + _M_narrow_ok = false; |
| 1098 | + for (size_t __j = 0; |
| 1099 | + __j < sizeof(_M_widen) / sizeof(wint_t); ++__j) |
| 1100 | + _M_widen[__j] = btowc(__j); |
| 1101 | + |
| 1102 | + for (size_t __k = 0; __k <= 11; ++__k) |
| 1103 | + { |
| 1104 | + _M_bit[__k] = static_cast<mask>(_ISbit(__k)); |
| 1105 | + _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); |
| 1106 | + } |
| 1107 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1108 | + __uselocale(__old); |
| 1109 | +#endif |
| 1110 | + } |
| 1111 | +#endif // _GLIBCXX_USE_WCHAR_T |
| 1112 | +} |
| 1113 | --- /dev/null |
| 1114 | +++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc |
| 1115 | @@ -0,0 +1,100 @@ |
| 1116 | +// std::messages implementation details, GNU version -*- C++ -*- |
| 1117 | + |
| 1118 | +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. |
| 1119 | +// |
| 1120 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 1121 | +// software; you can redistribute it and/or modify it under the |
| 1122 | +// terms of the GNU General Public License as published by the |
| 1123 | +// Free Software Foundation; either version 2, or (at your option) |
| 1124 | +// any later version. |
| 1125 | + |
| 1126 | +// This library is distributed in the hope that it will be useful, |
| 1127 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1128 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 1129 | +// GNU General Public License for more details. |
| 1130 | + |
| 1131 | +// You should have received a copy of the GNU General Public License along |
| 1132 | +// with this library; see the file COPYING. If not, write to the Free |
| 1133 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 1134 | +// USA. |
| 1135 | + |
| 1136 | +// As a special exception, you may use this file as part of a free software |
| 1137 | +// library without restriction. Specifically, if other files instantiate |
| 1138 | +// templates or use macros or inline functions from this file, or you compile |
| 1139 | +// this file and link it with other files to produce an executable, this |
| 1140 | +// file does not by itself cause the resulting executable to be covered by |
| 1141 | +// the GNU General Public License. This exception does not however |
| 1142 | +// invalidate any other reasons why the executable file might be covered by |
| 1143 | +// the GNU General Public License. |
| 1144 | + |
| 1145 | +// |
| 1146 | +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions |
| 1147 | +// |
| 1148 | + |
| 1149 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 1150 | + |
| 1151 | +#include <locale> |
| 1152 | +#include <bits/c++locale_internal.h> |
| 1153 | + |
| 1154 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 1155 | +#warning fix gettext stuff |
| 1156 | +#endif |
| 1157 | +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ |
| 1158 | +extern "C" char *__dcgettext(const char *domainname, |
| 1159 | + const char *msgid, int category); |
| 1160 | +#undef gettext |
| 1161 | +#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES) |
| 1162 | +#else |
| 1163 | +#undef gettext |
| 1164 | +#define gettext(msgid) (msgid) |
| 1165 | +#endif |
| 1166 | + |
| 1167 | +namespace std |
| 1168 | +{ |
| 1169 | + // Specializations. |
| 1170 | + template<> |
| 1171 | + string |
| 1172 | + messages<char>::do_get(catalog, int, int, const string& __dfault) const |
| 1173 | + { |
| 1174 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1175 | + __c_locale __old = __uselocale(_M_c_locale_messages); |
| 1176 | + const char* __msg = const_cast<const char*>(gettext(__dfault.c_str())); |
| 1177 | + __uselocale(__old); |
| 1178 | + return string(__msg); |
| 1179 | +#elif defined __UCLIBC_HAS_LOCALE__ |
| 1180 | + char* __old = strdup(setlocale(LC_ALL, NULL)); |
| 1181 | + setlocale(LC_ALL, _M_name_messages); |
| 1182 | + const char* __msg = gettext(__dfault.c_str()); |
| 1183 | + setlocale(LC_ALL, __old); |
| 1184 | + free(__old); |
| 1185 | + return string(__msg); |
| 1186 | +#else |
| 1187 | + const char* __msg = gettext(__dfault.c_str()); |
| 1188 | + return string(__msg); |
| 1189 | +#endif |
| 1190 | + } |
| 1191 | + |
| 1192 | +#ifdef _GLIBCXX_USE_WCHAR_T |
| 1193 | + template<> |
| 1194 | + wstring |
| 1195 | + messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const |
| 1196 | + { |
| 1197 | +# ifdef __UCLIBC_HAS_XLOCALE__ |
| 1198 | + __c_locale __old = __uselocale(_M_c_locale_messages); |
| 1199 | + char* __msg = gettext(_M_convert_to_char(__dfault)); |
| 1200 | + __uselocale(__old); |
| 1201 | + return _M_convert_from_char(__msg); |
| 1202 | +# elif defined __UCLIBC_HAS_LOCALE__ |
| 1203 | + char* __old = strdup(setlocale(LC_ALL, NULL)); |
| 1204 | + setlocale(LC_ALL, _M_name_messages); |
| 1205 | + char* __msg = gettext(_M_convert_to_char(__dfault)); |
| 1206 | + setlocale(LC_ALL, __old); |
| 1207 | + free(__old); |
| 1208 | + return _M_convert_from_char(__msg); |
| 1209 | +# else |
| 1210 | + char* __msg = gettext(_M_convert_to_char(__dfault)); |
| 1211 | + return _M_convert_from_char(__msg); |
| 1212 | +# endif |
| 1213 | + } |
| 1214 | +#endif |
| 1215 | +} |
| 1216 | --- /dev/null |
| 1217 | +++ b/libstdc++-v3/config/locale/uclibc/messages_members.h |
| 1218 | @@ -0,0 +1,121 @@ |
| 1219 | +// std::messages implementation details, GNU version -*- C++ -*- |
| 1220 | + |
| 1221 | +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 1222 | +// |
| 1223 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 1224 | +// software; you can redistribute it and/or modify it under the |
| 1225 | +// terms of the GNU General Public License as published by the |
| 1226 | +// Free Software Foundation; either version 2, or (at your option) |
| 1227 | +// any later version. |
| 1228 | + |
| 1229 | +// This library is distributed in the hope that it will be useful, |
| 1230 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1231 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 1232 | +// GNU General Public License for more details. |
| 1233 | + |
| 1234 | +// You should have received a copy of the GNU General Public License along |
| 1235 | +// with this library; see the file COPYING. If not, write to the Free |
| 1236 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 1237 | +// USA. |
| 1238 | + |
| 1239 | +// As a special exception, you may use this file as part of a free software |
| 1240 | +// library without restriction. Specifically, if other files instantiate |
| 1241 | +// templates or use macros or inline functions from this file, or you compile |
| 1242 | +// this file and link it with other files to produce an executable, this |
| 1243 | +// file does not by itself cause the resulting executable to be covered by |
| 1244 | +// the GNU General Public License. This exception does not however |
| 1245 | +// invalidate any other reasons why the executable file might be covered by |
| 1246 | +// the GNU General Public License. |
| 1247 | + |
| 1248 | +// |
| 1249 | +// ISO C++ 14882: 22.2.7.1.2 messages functions |
| 1250 | +// |
| 1251 | + |
| 1252 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 1253 | + |
| 1254 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 1255 | +#warning fix prototypes for *textdomain funcs |
| 1256 | +#endif |
| 1257 | +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ |
| 1258 | +extern "C" char *__textdomain(const char *domainname); |
| 1259 | +extern "C" char *__bindtextdomain(const char *domainname, |
| 1260 | + const char *dirname); |
| 1261 | +#else |
| 1262 | +#undef __textdomain |
| 1263 | +#undef __bindtextdomain |
| 1264 | +#define __textdomain(D) ((void)0) |
| 1265 | +#define __bindtextdomain(D,P) ((void)0) |
| 1266 | +#endif |
| 1267 | + |
| 1268 | + // Non-virtual member functions. |
| 1269 | + template<typename _CharT> |
| 1270 | + messages<_CharT>::messages(size_t __refs) |
| 1271 | + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), |
| 1272 | + _M_name_messages(_S_get_c_name()) |
| 1273 | + { } |
| 1274 | + |
| 1275 | + template<typename _CharT> |
| 1276 | + messages<_CharT>::messages(__c_locale __cloc, const char* __s, |
| 1277 | + size_t __refs) |
| 1278 | + : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL) |
| 1279 | + { |
| 1280 | + const size_t __len = std::strlen(__s) + 1; |
| 1281 | + char* __tmp = new char[__len]; |
| 1282 | + std::memcpy(__tmp, __s, __len); |
| 1283 | + _M_name_messages = __tmp; |
| 1284 | + |
| 1285 | + // Last to avoid leaking memory if new throws. |
| 1286 | + _M_c_locale_messages = _S_clone_c_locale(__cloc); |
| 1287 | + } |
| 1288 | + |
| 1289 | + template<typename _CharT> |
| 1290 | + typename messages<_CharT>::catalog |
| 1291 | + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, |
| 1292 | + const char* __dir) const |
| 1293 | + { |
| 1294 | + __bindtextdomain(__s.c_str(), __dir); |
| 1295 | + return this->do_open(__s, __loc); |
| 1296 | + } |
| 1297 | + |
| 1298 | + // Virtual member functions. |
| 1299 | + template<typename _CharT> |
| 1300 | + messages<_CharT>::~messages() |
| 1301 | + { |
| 1302 | + if (_M_name_messages != _S_get_c_name()) |
| 1303 | + delete [] _M_name_messages; |
| 1304 | + _S_destroy_c_locale(_M_c_locale_messages); |
| 1305 | + } |
| 1306 | + |
| 1307 | + template<typename _CharT> |
| 1308 | + typename messages<_CharT>::catalog |
| 1309 | + messages<_CharT>::do_open(const basic_string<char>& __s, |
| 1310 | + const locale&) const |
| 1311 | + { |
| 1312 | + // No error checking is done, assume the catalog exists and can |
| 1313 | + // be used. |
| 1314 | + __textdomain(__s.c_str()); |
| 1315 | + return 0; |
| 1316 | + } |
| 1317 | + |
| 1318 | + template<typename _CharT> |
| 1319 | + void |
| 1320 | + messages<_CharT>::do_close(catalog) const |
| 1321 | + { } |
| 1322 | + |
| 1323 | + // messages_byname |
| 1324 | + template<typename _CharT> |
| 1325 | + messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) |
| 1326 | + : messages<_CharT>(__refs) |
| 1327 | + { |
| 1328 | + if (this->_M_name_messages != locale::facet::_S_get_c_name()) |
| 1329 | + delete [] this->_M_name_messages; |
| 1330 | + char* __tmp = new char[std::strlen(__s) + 1]; |
| 1331 | + std::strcpy(__tmp, __s); |
| 1332 | + this->_M_name_messages = __tmp; |
| 1333 | + |
| 1334 | + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) |
| 1335 | + { |
| 1336 | + this->_S_destroy_c_locale(this->_M_c_locale_messages); |
| 1337 | + this->_S_create_c_locale(this->_M_c_locale_messages, __s); |
| 1338 | + } |
| 1339 | + } |
| 1340 | --- /dev/null |
| 1341 | +++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc |
| 1342 | @@ -0,0 +1,692 @@ |
| 1343 | +// std::moneypunct implementation details, GNU version -*- C++ -*- |
| 1344 | + |
| 1345 | +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
| 1346 | +// |
| 1347 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 1348 | +// software; you can redistribute it and/or modify it under the |
| 1349 | +// terms of the GNU General Public License as published by the |
| 1350 | +// Free Software Foundation; either version 2, or (at your option) |
| 1351 | +// any later version. |
| 1352 | + |
| 1353 | +// This library is distributed in the hope that it will be useful, |
| 1354 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1355 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 1356 | +// GNU General Public License for more details. |
| 1357 | + |
| 1358 | +// You should have received a copy of the GNU General Public License along |
| 1359 | +// with this library; see the file COPYING. If not, write to the Free |
| 1360 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 1361 | +// USA. |
| 1362 | + |
| 1363 | +// As a special exception, you may use this file as part of a free software |
| 1364 | +// library without restriction. Specifically, if other files instantiate |
| 1365 | +// templates or use macros or inline functions from this file, or you compile |
| 1366 | +// this file and link it with other files to produce an executable, this |
| 1367 | +// file does not by itself cause the resulting executable to be covered by |
| 1368 | +// the GNU General Public License. This exception does not however |
| 1369 | +// invalidate any other reasons why the executable file might be covered by |
| 1370 | +// the GNU General Public License. |
| 1371 | + |
| 1372 | +// |
| 1373 | +// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions |
| 1374 | +// |
| 1375 | + |
| 1376 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 1377 | + |
| 1378 | +#define _LIBC |
| 1379 | +#include <locale> |
| 1380 | +#undef _LIBC |
| 1381 | +#include <bits/c++locale_internal.h> |
| 1382 | + |
| 1383 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 1384 | +#warning optimize this for uclibc |
| 1385 | +#warning tailor for stub locale support |
| 1386 | +#endif |
| 1387 | + |
| 1388 | +#ifndef __UCLIBC_HAS_XLOCALE__ |
| 1389 | +#define __nl_langinfo_l(N, L) nl_langinfo((N)) |
| 1390 | +#endif |
| 1391 | + |
| 1392 | +namespace std |
| 1393 | +{ |
| 1394 | + // Construct and return valid pattern consisting of some combination of: |
| 1395 | + // space none symbol sign value |
| 1396 | + money_base::pattern |
| 1397 | + money_base::_S_construct_pattern(char __precedes, char __space, char __posn) |
| 1398 | + { |
| 1399 | + pattern __ret; |
| 1400 | + |
| 1401 | + // This insanely complicated routine attempts to construct a valid |
| 1402 | + // pattern for use with monyepunct. A couple of invariants: |
| 1403 | + |
| 1404 | + // if (__precedes) symbol -> value |
| 1405 | + // else value -> symbol |
| 1406 | + |
| 1407 | + // if (__space) space |
| 1408 | + // else none |
| 1409 | + |
| 1410 | + // none == never first |
| 1411 | + // space never first or last |
| 1412 | + |
| 1413 | + // Any elegant implementations of this are welcome. |
| 1414 | + switch (__posn) |
| 1415 | + { |
| 1416 | + case 0: |
| 1417 | + case 1: |
| 1418 | + // 1 The sign precedes the value and symbol. |
| 1419 | + __ret.field[0] = sign; |
| 1420 | + if (__space) |
| 1421 | + { |
| 1422 | + // Pattern starts with sign. |
| 1423 | + if (__precedes) |
| 1424 | + { |
| 1425 | + __ret.field[1] = symbol; |
| 1426 | + __ret.field[3] = value; |
| 1427 | + } |
| 1428 | + else |
| 1429 | + { |
| 1430 | + __ret.field[1] = value; |
| 1431 | + __ret.field[3] = symbol; |
| 1432 | + } |
| 1433 | + __ret.field[2] = space; |
| 1434 | + } |
| 1435 | + else |
| 1436 | + { |
| 1437 | + // Pattern starts with sign and ends with none. |
| 1438 | + if (__precedes) |
| 1439 | + { |
| 1440 | + __ret.field[1] = symbol; |
| 1441 | + __ret.field[2] = value; |
| 1442 | + } |
| 1443 | + else |
| 1444 | + { |
| 1445 | + __ret.field[1] = value; |
| 1446 | + __ret.field[2] = symbol; |
| 1447 | + } |
| 1448 | + __ret.field[3] = none; |
| 1449 | + } |
| 1450 | + break; |
| 1451 | + case 2: |
| 1452 | + // 2 The sign follows the value and symbol. |
| 1453 | + if (__space) |
| 1454 | + { |
| 1455 | + // Pattern either ends with sign. |
| 1456 | + if (__precedes) |
| 1457 | + { |
| 1458 | + __ret.field[0] = symbol; |
| 1459 | + __ret.field[2] = value; |
| 1460 | + } |
| 1461 | + else |
| 1462 | + { |
| 1463 | + __ret.field[0] = value; |
| 1464 | + __ret.field[2] = symbol; |
| 1465 | + } |
| 1466 | + __ret.field[1] = space; |
| 1467 | + __ret.field[3] = sign; |
| 1468 | + } |
| 1469 | + else |
| 1470 | + { |
| 1471 | + // Pattern ends with sign then none. |
| 1472 | + if (__precedes) |
| 1473 | + { |
| 1474 | + __ret.field[0] = symbol; |
| 1475 | + __ret.field[1] = value; |
| 1476 | + } |
| 1477 | + else |
| 1478 | + { |
| 1479 | + __ret.field[0] = value; |
| 1480 | + __ret.field[1] = symbol; |
| 1481 | + } |
| 1482 | + __ret.field[2] = sign; |
| 1483 | + __ret.field[3] = none; |
| 1484 | + } |
| 1485 | + break; |
| 1486 | + case 3: |
| 1487 | + // 3 The sign immediately precedes the symbol. |
| 1488 | + if (__precedes) |
| 1489 | + { |
| 1490 | + __ret.field[0] = sign; |
| 1491 | + __ret.field[1] = symbol; |
| 1492 | + if (__space) |
| 1493 | + { |
| 1494 | + __ret.field[2] = space; |
| 1495 | + __ret.field[3] = value; |
| 1496 | + } |
| 1497 | + else |
| 1498 | + { |
| 1499 | + __ret.field[2] = value; |
| 1500 | + __ret.field[3] = none; |
| 1501 | + } |
| 1502 | + } |
| 1503 | + else |
| 1504 | + { |
| 1505 | + __ret.field[0] = value; |
| 1506 | + if (__space) |
| 1507 | + { |
| 1508 | + __ret.field[1] = space; |
| 1509 | + __ret.field[2] = sign; |
| 1510 | + __ret.field[3] = symbol; |
| 1511 | + } |
| 1512 | + else |
| 1513 | + { |
| 1514 | + __ret.field[1] = sign; |
| 1515 | + __ret.field[2] = symbol; |
| 1516 | + __ret.field[3] = none; |
| 1517 | + } |
| 1518 | + } |
| 1519 | + break; |
| 1520 | + case 4: |
| 1521 | + // 4 The sign immediately follows the symbol. |
| 1522 | + if (__precedes) |
| 1523 | + { |
| 1524 | + __ret.field[0] = symbol; |
| 1525 | + __ret.field[1] = sign; |
| 1526 | + if (__space) |
| 1527 | + { |
| 1528 | + __ret.field[2] = space; |
| 1529 | + __ret.field[3] = value; |
| 1530 | + } |
| 1531 | + else |
| 1532 | + { |
| 1533 | + __ret.field[2] = value; |
| 1534 | + __ret.field[3] = none; |
| 1535 | + } |
| 1536 | + } |
| 1537 | + else |
| 1538 | + { |
| 1539 | + __ret.field[0] = value; |
| 1540 | + if (__space) |
| 1541 | + { |
| 1542 | + __ret.field[1] = space; |
| 1543 | + __ret.field[2] = symbol; |
| 1544 | + __ret.field[3] = sign; |
| 1545 | + } |
| 1546 | + else |
| 1547 | + { |
| 1548 | + __ret.field[1] = symbol; |
| 1549 | + __ret.field[2] = sign; |
| 1550 | + __ret.field[3] = none; |
| 1551 | + } |
| 1552 | + } |
| 1553 | + break; |
| 1554 | + default: |
| 1555 | + __ret = pattern(); |
| 1556 | + } |
| 1557 | + return __ret; |
| 1558 | + } |
| 1559 | + |
| 1560 | + template<> |
| 1561 | + void |
| 1562 | + moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, |
| 1563 | + const char*) |
| 1564 | + { |
| 1565 | + if (!_M_data) |
| 1566 | + _M_data = new __moneypunct_cache<char, true>; |
| 1567 | + |
| 1568 | + if (!__cloc) |
| 1569 | + { |
| 1570 | + // "C" locale |
| 1571 | + _M_data->_M_decimal_point = '.'; |
| 1572 | + _M_data->_M_thousands_sep = ','; |
| 1573 | + _M_data->_M_grouping = ""; |
| 1574 | + _M_data->_M_grouping_size = 0; |
| 1575 | + _M_data->_M_curr_symbol = ""; |
| 1576 | + _M_data->_M_curr_symbol_size = 0; |
| 1577 | + _M_data->_M_positive_sign = ""; |
| 1578 | + _M_data->_M_positive_sign_size = 0; |
| 1579 | + _M_data->_M_negative_sign = ""; |
| 1580 | + _M_data->_M_negative_sign_size = 0; |
| 1581 | + _M_data->_M_frac_digits = 0; |
| 1582 | + _M_data->_M_pos_format = money_base::_S_default_pattern; |
| 1583 | + _M_data->_M_neg_format = money_base::_S_default_pattern; |
| 1584 | + |
| 1585 | + for (size_t __i = 0; __i < money_base::_S_end; ++__i) |
| 1586 | + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; |
| 1587 | + } |
| 1588 | + else |
| 1589 | + { |
| 1590 | + // Named locale. |
| 1591 | + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, |
| 1592 | + __cloc)); |
| 1593 | + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, |
| 1594 | + __cloc)); |
| 1595 | + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); |
| 1596 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); |
| 1597 | + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); |
| 1598 | + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); |
| 1599 | + |
| 1600 | + char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); |
| 1601 | + if (!__nposn) |
| 1602 | + _M_data->_M_negative_sign = "()"; |
| 1603 | + else |
| 1604 | + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, |
| 1605 | + __cloc); |
| 1606 | + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); |
| 1607 | + |
| 1608 | + // _Intl == true |
| 1609 | + _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); |
| 1610 | + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); |
| 1611 | + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, |
| 1612 | + __cloc)); |
| 1613 | + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); |
| 1614 | + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); |
| 1615 | + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); |
| 1616 | + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, |
| 1617 | + __pposn); |
| 1618 | + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); |
| 1619 | + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); |
| 1620 | + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, |
| 1621 | + __nposn); |
| 1622 | + } |
| 1623 | + } |
| 1624 | + |
| 1625 | + template<> |
| 1626 | + void |
| 1627 | + moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, |
| 1628 | + const char*) |
| 1629 | + { |
| 1630 | + if (!_M_data) |
| 1631 | + _M_data = new __moneypunct_cache<char, false>; |
| 1632 | + |
| 1633 | + if (!__cloc) |
| 1634 | + { |
| 1635 | + // "C" locale |
| 1636 | + _M_data->_M_decimal_point = '.'; |
| 1637 | + _M_data->_M_thousands_sep = ','; |
| 1638 | + _M_data->_M_grouping = ""; |
| 1639 | + _M_data->_M_grouping_size = 0; |
| 1640 | + _M_data->_M_curr_symbol = ""; |
| 1641 | + _M_data->_M_curr_symbol_size = 0; |
| 1642 | + _M_data->_M_positive_sign = ""; |
| 1643 | + _M_data->_M_positive_sign_size = 0; |
| 1644 | + _M_data->_M_negative_sign = ""; |
| 1645 | + _M_data->_M_negative_sign_size = 0; |
| 1646 | + _M_data->_M_frac_digits = 0; |
| 1647 | + _M_data->_M_pos_format = money_base::_S_default_pattern; |
| 1648 | + _M_data->_M_neg_format = money_base::_S_default_pattern; |
| 1649 | + |
| 1650 | + for (size_t __i = 0; __i < money_base::_S_end; ++__i) |
| 1651 | + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; |
| 1652 | + } |
| 1653 | + else |
| 1654 | + { |
| 1655 | + // Named locale. |
| 1656 | + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, |
| 1657 | + __cloc)); |
| 1658 | + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, |
| 1659 | + __cloc)); |
| 1660 | + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); |
| 1661 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); |
| 1662 | + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); |
| 1663 | + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); |
| 1664 | + |
| 1665 | + char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); |
| 1666 | + if (!__nposn) |
| 1667 | + _M_data->_M_negative_sign = "()"; |
| 1668 | + else |
| 1669 | + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, |
| 1670 | + __cloc); |
| 1671 | + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); |
| 1672 | + |
| 1673 | + // _Intl == false |
| 1674 | + _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); |
| 1675 | + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); |
| 1676 | + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); |
| 1677 | + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); |
| 1678 | + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); |
| 1679 | + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); |
| 1680 | + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, |
| 1681 | + __pposn); |
| 1682 | + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); |
| 1683 | + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); |
| 1684 | + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, |
| 1685 | + __nposn); |
| 1686 | + } |
| 1687 | + } |
| 1688 | + |
| 1689 | + template<> |
| 1690 | + moneypunct<char, true>::~moneypunct() |
| 1691 | + { delete _M_data; } |
| 1692 | + |
| 1693 | + template<> |
| 1694 | + moneypunct<char, false>::~moneypunct() |
| 1695 | + { delete _M_data; } |
| 1696 | + |
| 1697 | +#ifdef _GLIBCXX_USE_WCHAR_T |
| 1698 | + template<> |
| 1699 | + void |
| 1700 | + moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, |
| 1701 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1702 | + const char*) |
| 1703 | +#else |
| 1704 | + const char* __name) |
| 1705 | +#endif |
| 1706 | + { |
| 1707 | + if (!_M_data) |
| 1708 | + _M_data = new __moneypunct_cache<wchar_t, true>; |
| 1709 | + |
| 1710 | + if (!__cloc) |
| 1711 | + { |
| 1712 | + // "C" locale |
| 1713 | + _M_data->_M_decimal_point = L'.'; |
| 1714 | + _M_data->_M_thousands_sep = L','; |
| 1715 | + _M_data->_M_grouping = ""; |
| 1716 | + _M_data->_M_grouping_size = 0; |
| 1717 | + _M_data->_M_curr_symbol = L""; |
| 1718 | + _M_data->_M_curr_symbol_size = 0; |
| 1719 | + _M_data->_M_positive_sign = L""; |
| 1720 | + _M_data->_M_positive_sign_size = 0; |
| 1721 | + _M_data->_M_negative_sign = L""; |
| 1722 | + _M_data->_M_negative_sign_size = 0; |
| 1723 | + _M_data->_M_frac_digits = 0; |
| 1724 | + _M_data->_M_pos_format = money_base::_S_default_pattern; |
| 1725 | + _M_data->_M_neg_format = money_base::_S_default_pattern; |
| 1726 | + |
| 1727 | + // Use ctype::widen code without the facet... |
| 1728 | + for (size_t __i = 0; __i < money_base::_S_end; ++__i) |
| 1729 | + _M_data->_M_atoms[__i] = |
| 1730 | + static_cast<wchar_t>(money_base::_S_atoms[__i]); |
| 1731 | + } |
| 1732 | + else |
| 1733 | + { |
| 1734 | + // Named locale. |
| 1735 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1736 | + __c_locale __old = __uselocale(__cloc); |
| 1737 | +#else |
| 1738 | + // Switch to named locale so that mbsrtowcs will work. |
| 1739 | + char* __old = strdup(setlocale(LC_ALL, NULL)); |
| 1740 | + setlocale(LC_ALL, __name); |
| 1741 | +#endif |
| 1742 | + |
| 1743 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 1744 | +#warning fix this... should be monetary |
| 1745 | +#endif |
| 1746 | +#ifdef __UCLIBC__ |
| 1747 | +# ifdef __UCLIBC_HAS_XLOCALE__ |
| 1748 | + _M_data->_M_decimal_point = __cloc->decimal_point_wc; |
| 1749 | + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; |
| 1750 | +# elif defined __UCLIBC_HAS_LOCALE__ |
| 1751 | + _M_data->_M_decimal_point = __global_locale->decimal_point_wc; |
| 1752 | + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; |
| 1753 | +# endif |
| 1754 | +#else |
| 1755 | + union { char *__s; wchar_t __w; } __u; |
| 1756 | + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); |
| 1757 | + _M_data->_M_decimal_point = __u.__w; |
| 1758 | + |
| 1759 | + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); |
| 1760 | + _M_data->_M_thousands_sep = __u.__w; |
| 1761 | +#endif |
| 1762 | + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); |
| 1763 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); |
| 1764 | + |
| 1765 | + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); |
| 1766 | + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); |
| 1767 | + const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); |
| 1768 | + |
| 1769 | + wchar_t* __wcs_ps = 0; |
| 1770 | + wchar_t* __wcs_ns = 0; |
| 1771 | + const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); |
| 1772 | + try |
| 1773 | + { |
| 1774 | + mbstate_t __state; |
| 1775 | + size_t __len = strlen(__cpossign); |
| 1776 | + if (__len) |
| 1777 | + { |
| 1778 | + ++__len; |
| 1779 | + memset(&__state, 0, sizeof(mbstate_t)); |
| 1780 | + __wcs_ps = new wchar_t[__len]; |
| 1781 | + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); |
| 1782 | + _M_data->_M_positive_sign = __wcs_ps; |
| 1783 | + } |
| 1784 | + else |
| 1785 | + _M_data->_M_positive_sign = L""; |
| 1786 | + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); |
| 1787 | + |
| 1788 | + __len = strlen(__cnegsign); |
| 1789 | + if (!__nposn) |
| 1790 | + _M_data->_M_negative_sign = L"()"; |
| 1791 | + else if (__len) |
| 1792 | + { |
| 1793 | + ++__len; |
| 1794 | + memset(&__state, 0, sizeof(mbstate_t)); |
| 1795 | + __wcs_ns = new wchar_t[__len]; |
| 1796 | + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); |
| 1797 | + _M_data->_M_negative_sign = __wcs_ns; |
| 1798 | + } |
| 1799 | + else |
| 1800 | + _M_data->_M_negative_sign = L""; |
| 1801 | + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); |
| 1802 | + |
| 1803 | + // _Intl == true. |
| 1804 | + __len = strlen(__ccurr); |
| 1805 | + if (__len) |
| 1806 | + { |
| 1807 | + ++__len; |
| 1808 | + memset(&__state, 0, sizeof(mbstate_t)); |
| 1809 | + wchar_t* __wcs = new wchar_t[__len]; |
| 1810 | + mbsrtowcs(__wcs, &__ccurr, __len, &__state); |
| 1811 | + _M_data->_M_curr_symbol = __wcs; |
| 1812 | + } |
| 1813 | + else |
| 1814 | + _M_data->_M_curr_symbol = L""; |
| 1815 | + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); |
| 1816 | + } |
| 1817 | + catch (...) |
| 1818 | + { |
| 1819 | + delete _M_data; |
| 1820 | + _M_data = 0; |
| 1821 | + delete __wcs_ps; |
| 1822 | + delete __wcs_ns; |
| 1823 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1824 | + __uselocale(__old); |
| 1825 | +#else |
| 1826 | + setlocale(LC_ALL, __old); |
| 1827 | + free(__old); |
| 1828 | +#endif |
| 1829 | + __throw_exception_again; |
| 1830 | + } |
| 1831 | + |
| 1832 | + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, |
| 1833 | + __cloc)); |
| 1834 | + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); |
| 1835 | + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); |
| 1836 | + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); |
| 1837 | + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, |
| 1838 | + __pposn); |
| 1839 | + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); |
| 1840 | + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); |
| 1841 | + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, |
| 1842 | + __nposn); |
| 1843 | + |
| 1844 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1845 | + __uselocale(__old); |
| 1846 | +#else |
| 1847 | + setlocale(LC_ALL, __old); |
| 1848 | + free(__old); |
| 1849 | +#endif |
| 1850 | + } |
| 1851 | + } |
| 1852 | + |
| 1853 | + template<> |
| 1854 | + void |
| 1855 | + moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc, |
| 1856 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1857 | + const char*) |
| 1858 | +#else |
| 1859 | + const char* __name) |
| 1860 | +#endif |
| 1861 | + { |
| 1862 | + if (!_M_data) |
| 1863 | + _M_data = new __moneypunct_cache<wchar_t, false>; |
| 1864 | + |
| 1865 | + if (!__cloc) |
| 1866 | + { |
| 1867 | + // "C" locale |
| 1868 | + _M_data->_M_decimal_point = L'.'; |
| 1869 | + _M_data->_M_thousands_sep = L','; |
| 1870 | + _M_data->_M_grouping = ""; |
| 1871 | + _M_data->_M_grouping_size = 0; |
| 1872 | + _M_data->_M_curr_symbol = L""; |
| 1873 | + _M_data->_M_curr_symbol_size = 0; |
| 1874 | + _M_data->_M_positive_sign = L""; |
| 1875 | + _M_data->_M_positive_sign_size = 0; |
| 1876 | + _M_data->_M_negative_sign = L""; |
| 1877 | + _M_data->_M_negative_sign_size = 0; |
| 1878 | + _M_data->_M_frac_digits = 0; |
| 1879 | + _M_data->_M_pos_format = money_base::_S_default_pattern; |
| 1880 | + _M_data->_M_neg_format = money_base::_S_default_pattern; |
| 1881 | + |
| 1882 | + // Use ctype::widen code without the facet... |
| 1883 | + for (size_t __i = 0; __i < money_base::_S_end; ++__i) |
| 1884 | + _M_data->_M_atoms[__i] = |
| 1885 | + static_cast<wchar_t>(money_base::_S_atoms[__i]); |
| 1886 | + } |
| 1887 | + else |
| 1888 | + { |
| 1889 | + // Named locale. |
| 1890 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1891 | + __c_locale __old = __uselocale(__cloc); |
| 1892 | +#else |
| 1893 | + // Switch to named locale so that mbsrtowcs will work. |
| 1894 | + char* __old = strdup(setlocale(LC_ALL, NULL)); |
| 1895 | + setlocale(LC_ALL, __name); |
| 1896 | +#endif |
| 1897 | + |
| 1898 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 1899 | +#warning fix this... should be monetary |
| 1900 | +#endif |
| 1901 | +#ifdef __UCLIBC__ |
| 1902 | +# ifdef __UCLIBC_HAS_XLOCALE__ |
| 1903 | + _M_data->_M_decimal_point = __cloc->decimal_point_wc; |
| 1904 | + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; |
| 1905 | +# elif defined __UCLIBC_HAS_LOCALE__ |
| 1906 | + _M_data->_M_decimal_point = __global_locale->decimal_point_wc; |
| 1907 | + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; |
| 1908 | +# endif |
| 1909 | +#else |
| 1910 | + union { char *__s; wchar_t __w; } __u; |
| 1911 | + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); |
| 1912 | + _M_data->_M_decimal_point = __u.__w; |
| 1913 | + |
| 1914 | + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); |
| 1915 | + _M_data->_M_thousands_sep = __u.__w; |
| 1916 | +#endif |
| 1917 | + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); |
| 1918 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); |
| 1919 | + |
| 1920 | + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); |
| 1921 | + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); |
| 1922 | + const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); |
| 1923 | + |
| 1924 | + wchar_t* __wcs_ps = 0; |
| 1925 | + wchar_t* __wcs_ns = 0; |
| 1926 | + const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); |
| 1927 | + try |
| 1928 | + { |
| 1929 | + mbstate_t __state; |
| 1930 | + size_t __len; |
| 1931 | + __len = strlen(__cpossign); |
| 1932 | + if (__len) |
| 1933 | + { |
| 1934 | + ++__len; |
| 1935 | + memset(&__state, 0, sizeof(mbstate_t)); |
| 1936 | + __wcs_ps = new wchar_t[__len]; |
| 1937 | + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); |
| 1938 | + _M_data->_M_positive_sign = __wcs_ps; |
| 1939 | + } |
| 1940 | + else |
| 1941 | + _M_data->_M_positive_sign = L""; |
| 1942 | + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); |
| 1943 | + |
| 1944 | + __len = strlen(__cnegsign); |
| 1945 | + if (!__nposn) |
| 1946 | + _M_data->_M_negative_sign = L"()"; |
| 1947 | + else if (__len) |
| 1948 | + { |
| 1949 | + ++__len; |
| 1950 | + memset(&__state, 0, sizeof(mbstate_t)); |
| 1951 | + __wcs_ns = new wchar_t[__len]; |
| 1952 | + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); |
| 1953 | + _M_data->_M_negative_sign = __wcs_ns; |
| 1954 | + } |
| 1955 | + else |
| 1956 | + _M_data->_M_negative_sign = L""; |
| 1957 | + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); |
| 1958 | + |
| 1959 | + // _Intl == true. |
| 1960 | + __len = strlen(__ccurr); |
| 1961 | + if (__len) |
| 1962 | + { |
| 1963 | + ++__len; |
| 1964 | + memset(&__state, 0, sizeof(mbstate_t)); |
| 1965 | + wchar_t* __wcs = new wchar_t[__len]; |
| 1966 | + mbsrtowcs(__wcs, &__ccurr, __len, &__state); |
| 1967 | + _M_data->_M_curr_symbol = __wcs; |
| 1968 | + } |
| 1969 | + else |
| 1970 | + _M_data->_M_curr_symbol = L""; |
| 1971 | + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); |
| 1972 | + } |
| 1973 | + catch (...) |
| 1974 | + { |
| 1975 | + delete _M_data; |
| 1976 | + _M_data = 0; |
| 1977 | + delete __wcs_ps; |
| 1978 | + delete __wcs_ns; |
| 1979 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 1980 | + __uselocale(__old); |
| 1981 | +#else |
| 1982 | + setlocale(LC_ALL, __old); |
| 1983 | + free(__old); |
| 1984 | +#endif |
| 1985 | + __throw_exception_again; |
| 1986 | + } |
| 1987 | + |
| 1988 | + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); |
| 1989 | + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); |
| 1990 | + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); |
| 1991 | + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); |
| 1992 | + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, |
| 1993 | + __pposn); |
| 1994 | + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); |
| 1995 | + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); |
| 1996 | + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, |
| 1997 | + __nposn); |
| 1998 | + |
| 1999 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 2000 | + __uselocale(__old); |
| 2001 | +#else |
| 2002 | + setlocale(LC_ALL, __old); |
| 2003 | + free(__old); |
| 2004 | +#endif |
| 2005 | + } |
| 2006 | + } |
| 2007 | + |
| 2008 | + template<> |
| 2009 | + moneypunct<wchar_t, true>::~moneypunct() |
| 2010 | + { |
| 2011 | + if (_M_data->_M_positive_sign_size) |
| 2012 | + delete [] _M_data->_M_positive_sign; |
| 2013 | + if (_M_data->_M_negative_sign_size |
| 2014 | + && wcscmp(_M_data->_M_negative_sign, L"()") != 0) |
| 2015 | + delete [] _M_data->_M_negative_sign; |
| 2016 | + if (_M_data->_M_curr_symbol_size) |
| 2017 | + delete [] _M_data->_M_curr_symbol; |
| 2018 | + delete _M_data; |
| 2019 | + } |
| 2020 | + |
| 2021 | + template<> |
| 2022 | + moneypunct<wchar_t, false>::~moneypunct() |
| 2023 | + { |
| 2024 | + if (_M_data->_M_positive_sign_size) |
| 2025 | + delete [] _M_data->_M_positive_sign; |
| 2026 | + if (_M_data->_M_negative_sign_size |
| 2027 | + && wcscmp(_M_data->_M_negative_sign, L"()") != 0) |
| 2028 | + delete [] _M_data->_M_negative_sign; |
| 2029 | + if (_M_data->_M_curr_symbol_size) |
| 2030 | + delete [] _M_data->_M_curr_symbol; |
| 2031 | + delete _M_data; |
| 2032 | + } |
| 2033 | +#endif |
| 2034 | +} |
| 2035 | --- /dev/null |
| 2036 | +++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc |
| 2037 | @@ -0,0 +1,173 @@ |
| 2038 | +// std::numpunct implementation details, GNU version -*- C++ -*- |
| 2039 | + |
| 2040 | +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
| 2041 | +// |
| 2042 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 2043 | +// software; you can redistribute it and/or modify it under the |
| 2044 | +// terms of the GNU General Public License as published by the |
| 2045 | +// Free Software Foundation; either version 2, or (at your option) |
| 2046 | +// any later version. |
| 2047 | + |
| 2048 | +// This library is distributed in the hope that it will be useful, |
| 2049 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2050 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2051 | +// GNU General Public License for more details. |
| 2052 | + |
| 2053 | +// You should have received a copy of the GNU General Public License along |
| 2054 | +// with this library; see the file COPYING. If not, write to the Free |
| 2055 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 2056 | +// USA. |
| 2057 | + |
| 2058 | +// As a special exception, you may use this file as part of a free software |
| 2059 | +// library without restriction. Specifically, if other files instantiate |
| 2060 | +// templates or use macros or inline functions from this file, or you compile |
| 2061 | +// this file and link it with other files to produce an executable, this |
| 2062 | +// file does not by itself cause the resulting executable to be covered by |
| 2063 | +// the GNU General Public License. This exception does not however |
| 2064 | +// invalidate any other reasons why the executable file might be covered by |
| 2065 | +// the GNU General Public License. |
| 2066 | + |
| 2067 | +// |
| 2068 | +// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions |
| 2069 | +// |
| 2070 | + |
| 2071 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 2072 | + |
| 2073 | +#define _LIBC |
| 2074 | +#include <locale> |
| 2075 | +#undef _LIBC |
| 2076 | +#include <bits/c++locale_internal.h> |
| 2077 | + |
| 2078 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 2079 | +#warning tailor for stub locale support |
| 2080 | +#endif |
| 2081 | +#ifndef __UCLIBC_HAS_XLOCALE__ |
| 2082 | +#define __nl_langinfo_l(N, L) nl_langinfo((N)) |
| 2083 | +#endif |
| 2084 | + |
| 2085 | +namespace std |
| 2086 | +{ |
| 2087 | + template<> |
| 2088 | + void |
| 2089 | + numpunct<char>::_M_initialize_numpunct(__c_locale __cloc) |
| 2090 | + { |
| 2091 | + if (!_M_data) |
| 2092 | + _M_data = new __numpunct_cache<char>; |
| 2093 | + |
| 2094 | + if (!__cloc) |
| 2095 | + { |
| 2096 | + // "C" locale |
| 2097 | + _M_data->_M_grouping = ""; |
| 2098 | + _M_data->_M_grouping_size = 0; |
| 2099 | + _M_data->_M_use_grouping = false; |
| 2100 | + |
| 2101 | + _M_data->_M_decimal_point = '.'; |
| 2102 | + _M_data->_M_thousands_sep = ','; |
| 2103 | + |
| 2104 | + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) |
| 2105 | + _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; |
| 2106 | + |
| 2107 | + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) |
| 2108 | + _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j]; |
| 2109 | + } |
| 2110 | + else |
| 2111 | + { |
| 2112 | + // Named locale. |
| 2113 | + _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, |
| 2114 | + __cloc)); |
| 2115 | + _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, |
| 2116 | + __cloc)); |
| 2117 | + |
| 2118 | + // Check for NULL, which implies no grouping. |
| 2119 | + if (_M_data->_M_thousands_sep == '\0') |
| 2120 | + _M_data->_M_grouping = ""; |
| 2121 | + else |
| 2122 | + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); |
| 2123 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); |
| 2124 | + } |
| 2125 | + |
| 2126 | + // NB: There is no way to extact this info from posix locales. |
| 2127 | + // _M_truename = __nl_langinfo_l(YESSTR, __cloc); |
| 2128 | + _M_data->_M_truename = "true"; |
| 2129 | + _M_data->_M_truename_size = 4; |
| 2130 | + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); |
| 2131 | + _M_data->_M_falsename = "false"; |
| 2132 | + _M_data->_M_falsename_size = 5; |
| 2133 | + } |
| 2134 | + |
| 2135 | + template<> |
| 2136 | + numpunct<char>::~numpunct() |
| 2137 | + { delete _M_data; } |
| 2138 | + |
| 2139 | +#ifdef _GLIBCXX_USE_WCHAR_T |
| 2140 | + template<> |
| 2141 | + void |
| 2142 | + numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc) |
| 2143 | + { |
| 2144 | + if (!_M_data) |
| 2145 | + _M_data = new __numpunct_cache<wchar_t>; |
| 2146 | + |
| 2147 | + if (!__cloc) |
| 2148 | + { |
| 2149 | + // "C" locale |
| 2150 | + _M_data->_M_grouping = ""; |
| 2151 | + _M_data->_M_grouping_size = 0; |
| 2152 | + _M_data->_M_use_grouping = false; |
| 2153 | + |
| 2154 | + _M_data->_M_decimal_point = L'.'; |
| 2155 | + _M_data->_M_thousands_sep = L','; |
| 2156 | + |
| 2157 | + // Use ctype::widen code without the facet... |
| 2158 | + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) |
| 2159 | + _M_data->_M_atoms_out[__i] = |
| 2160 | + static_cast<wchar_t>(__num_base::_S_atoms_out[__i]); |
| 2161 | + |
| 2162 | + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) |
| 2163 | + _M_data->_M_atoms_in[__j] = |
| 2164 | + static_cast<wchar_t>(__num_base::_S_atoms_in[__j]); |
| 2165 | + } |
| 2166 | + else |
| 2167 | + { |
| 2168 | + // Named locale. |
| 2169 | + // NB: In the GNU model wchar_t is always 32 bit wide. |
| 2170 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 2171 | +#warning fix this |
| 2172 | +#endif |
| 2173 | +#ifdef __UCLIBC__ |
| 2174 | +# ifdef __UCLIBC_HAS_XLOCALE__ |
| 2175 | + _M_data->_M_decimal_point = __cloc->decimal_point_wc; |
| 2176 | + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; |
| 2177 | +# elif defined __UCLIBC_HAS_LOCALE__ |
| 2178 | + _M_data->_M_decimal_point = __global_locale->decimal_point_wc; |
| 2179 | + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; |
| 2180 | +# endif |
| 2181 | +#else |
| 2182 | + union { char *__s; wchar_t __w; } __u; |
| 2183 | + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); |
| 2184 | + _M_data->_M_decimal_point = __u.__w; |
| 2185 | + |
| 2186 | + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); |
| 2187 | + _M_data->_M_thousands_sep = __u.__w; |
| 2188 | +#endif |
| 2189 | + |
| 2190 | + if (_M_data->_M_thousands_sep == L'\0') |
| 2191 | + _M_data->_M_grouping = ""; |
| 2192 | + else |
| 2193 | + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); |
| 2194 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); |
| 2195 | + } |
| 2196 | + |
| 2197 | + // NB: There is no way to extact this info from posix locales. |
| 2198 | + // _M_truename = __nl_langinfo_l(YESSTR, __cloc); |
| 2199 | + _M_data->_M_truename = L"true"; |
| 2200 | + _M_data->_M_truename_size = 4; |
| 2201 | + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); |
| 2202 | + _M_data->_M_falsename = L"false"; |
| 2203 | + _M_data->_M_falsename_size = 5; |
| 2204 | + } |
| 2205 | + |
| 2206 | + template<> |
| 2207 | + numpunct<wchar_t>::~numpunct() |
| 2208 | + { delete _M_data; } |
| 2209 | + #endif |
| 2210 | +} |
| 2211 | --- /dev/null |
| 2212 | +++ b/libstdc++-v3/config/locale/uclibc/time_members.cc |
| 2213 | @@ -0,0 +1,406 @@ |
| 2214 | +// std::time_get, std::time_put implementation, GNU version -*- C++ -*- |
| 2215 | + |
| 2216 | +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
| 2217 | +// |
| 2218 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 2219 | +// software; you can redistribute it and/or modify it under the |
| 2220 | +// terms of the GNU General Public License as published by the |
| 2221 | +// Free Software Foundation; either version 2, or (at your option) |
| 2222 | +// any later version. |
| 2223 | + |
| 2224 | +// This library is distributed in the hope that it will be useful, |
| 2225 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2226 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2227 | +// GNU General Public License for more details. |
| 2228 | + |
| 2229 | +// You should have received a copy of the GNU General Public License along |
| 2230 | +// with this library; see the file COPYING. If not, write to the Free |
| 2231 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 2232 | +// USA. |
| 2233 | + |
| 2234 | +// As a special exception, you may use this file as part of a free software |
| 2235 | +// library without restriction. Specifically, if other files instantiate |
| 2236 | +// templates or use macros or inline functions from this file, or you compile |
| 2237 | +// this file and link it with other files to produce an executable, this |
| 2238 | +// file does not by itself cause the resulting executable to be covered by |
| 2239 | +// the GNU General Public License. This exception does not however |
| 2240 | +// invalidate any other reasons why the executable file might be covered by |
| 2241 | +// the GNU General Public License. |
| 2242 | + |
| 2243 | +// |
| 2244 | +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions |
| 2245 | +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions |
| 2246 | +// |
| 2247 | + |
| 2248 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 2249 | + |
| 2250 | +#include <locale> |
| 2251 | +#include <bits/c++locale_internal.h> |
| 2252 | + |
| 2253 | +#ifdef __UCLIBC_MJN3_ONLY__ |
| 2254 | +#warning tailor for stub locale support |
| 2255 | +#endif |
| 2256 | +#ifndef __UCLIBC_HAS_XLOCALE__ |
| 2257 | +#define __nl_langinfo_l(N, L) nl_langinfo((N)) |
| 2258 | +#endif |
| 2259 | + |
| 2260 | +namespace std |
| 2261 | +{ |
| 2262 | + template<> |
| 2263 | + void |
| 2264 | + __timepunct<char>:: |
| 2265 | + _M_put(char* __s, size_t __maxlen, const char* __format, |
| 2266 | + const tm* __tm) const |
| 2267 | + { |
| 2268 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 2269 | + const size_t __len = __strftime_l(__s, __maxlen, __format, __tm, |
| 2270 | + _M_c_locale_timepunct); |
| 2271 | +#else |
| 2272 | + char* __old = strdup(setlocale(LC_ALL, NULL)); |
| 2273 | + setlocale(LC_ALL, _M_name_timepunct); |
| 2274 | + const size_t __len = strftime(__s, __maxlen, __format, __tm); |
| 2275 | + setlocale(LC_ALL, __old); |
| 2276 | + free(__old); |
| 2277 | +#endif |
| 2278 | + // Make sure __s is null terminated. |
| 2279 | + if (__len == 0) |
| 2280 | + __s[0] = '\0'; |
| 2281 | + } |
| 2282 | + |
| 2283 | + template<> |
| 2284 | + void |
| 2285 | + __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc) |
| 2286 | + { |
| 2287 | + if (!_M_data) |
| 2288 | + _M_data = new __timepunct_cache<char>; |
| 2289 | + |
| 2290 | + if (!__cloc) |
| 2291 | + { |
| 2292 | + // "C" locale |
| 2293 | + _M_c_locale_timepunct = _S_get_c_locale(); |
| 2294 | + |
| 2295 | + _M_data->_M_date_format = "%m/%d/%y"; |
| 2296 | + _M_data->_M_date_era_format = "%m/%d/%y"; |
| 2297 | + _M_data->_M_time_format = "%H:%M:%S"; |
| 2298 | + _M_data->_M_time_era_format = "%H:%M:%S"; |
| 2299 | + _M_data->_M_date_time_format = ""; |
| 2300 | + _M_data->_M_date_time_era_format = ""; |
| 2301 | + _M_data->_M_am = "AM"; |
| 2302 | + _M_data->_M_pm = "PM"; |
| 2303 | + _M_data->_M_am_pm_format = ""; |
| 2304 | + |
| 2305 | + // Day names, starting with "C"'s Sunday. |
| 2306 | + _M_data->_M_day1 = "Sunday"; |
| 2307 | + _M_data->_M_day2 = "Monday"; |
| 2308 | + _M_data->_M_day3 = "Tuesday"; |
| 2309 | + _M_data->_M_day4 = "Wednesday"; |
| 2310 | + _M_data->_M_day5 = "Thursday"; |
| 2311 | + _M_data->_M_day6 = "Friday"; |
| 2312 | + _M_data->_M_day7 = "Saturday"; |
| 2313 | + |
| 2314 | + // Abbreviated day names, starting with "C"'s Sun. |
| 2315 | + _M_data->_M_aday1 = "Sun"; |
| 2316 | + _M_data->_M_aday2 = "Mon"; |
| 2317 | + _M_data->_M_aday3 = "Tue"; |
| 2318 | + _M_data->_M_aday4 = "Wed"; |
| 2319 | + _M_data->_M_aday5 = "Thu"; |
| 2320 | + _M_data->_M_aday6 = "Fri"; |
| 2321 | + _M_data->_M_aday7 = "Sat"; |
| 2322 | + |
| 2323 | + // Month names, starting with "C"'s January. |
| 2324 | + _M_data->_M_month01 = "January"; |
| 2325 | + _M_data->_M_month02 = "February"; |
| 2326 | + _M_data->_M_month03 = "March"; |
| 2327 | + _M_data->_M_month04 = "April"; |
| 2328 | + _M_data->_M_month05 = "May"; |
| 2329 | + _M_data->_M_month06 = "June"; |
| 2330 | + _M_data->_M_month07 = "July"; |
| 2331 | + _M_data->_M_month08 = "August"; |
| 2332 | + _M_data->_M_month09 = "September"; |
| 2333 | + _M_data->_M_month10 = "October"; |
| 2334 | + _M_data->_M_month11 = "November"; |
| 2335 | + _M_data->_M_month12 = "December"; |
| 2336 | + |
| 2337 | + // Abbreviated month names, starting with "C"'s Jan. |
| 2338 | + _M_data->_M_amonth01 = "Jan"; |
| 2339 | + _M_data->_M_amonth02 = "Feb"; |
| 2340 | + _M_data->_M_amonth03 = "Mar"; |
| 2341 | + _M_data->_M_amonth04 = "Apr"; |
| 2342 | + _M_data->_M_amonth05 = "May"; |
| 2343 | + _M_data->_M_amonth06 = "Jun"; |
| 2344 | + _M_data->_M_amonth07 = "Jul"; |
| 2345 | + _M_data->_M_amonth08 = "Aug"; |
| 2346 | + _M_data->_M_amonth09 = "Sep"; |
| 2347 | + _M_data->_M_amonth10 = "Oct"; |
| 2348 | + _M_data->_M_amonth11 = "Nov"; |
| 2349 | + _M_data->_M_amonth12 = "Dec"; |
| 2350 | + } |
| 2351 | + else |
| 2352 | + { |
| 2353 | + _M_c_locale_timepunct = _S_clone_c_locale(__cloc); |
| 2354 | + |
| 2355 | + _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc); |
| 2356 | + _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); |
| 2357 | + _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc); |
| 2358 | + _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); |
| 2359 | + _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); |
| 2360 | + _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, |
| 2361 | + __cloc); |
| 2362 | + _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc); |
| 2363 | + _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc); |
| 2364 | + _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); |
| 2365 | + |
| 2366 | + // Day names, starting with "C"'s Sunday. |
| 2367 | + _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc); |
| 2368 | + _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc); |
| 2369 | + _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc); |
| 2370 | + _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc); |
| 2371 | + _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc); |
| 2372 | + _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc); |
| 2373 | + _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc); |
| 2374 | + |
| 2375 | + // Abbreviated day names, starting with "C"'s Sun. |
| 2376 | + _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc); |
| 2377 | + _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc); |
| 2378 | + _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc); |
| 2379 | + _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc); |
| 2380 | + _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc); |
| 2381 | + _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc); |
| 2382 | + _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc); |
| 2383 | + |
| 2384 | + // Month names, starting with "C"'s January. |
| 2385 | + _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc); |
| 2386 | + _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc); |
| 2387 | + _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc); |
| 2388 | + _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc); |
| 2389 | + _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc); |
| 2390 | + _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc); |
| 2391 | + _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc); |
| 2392 | + _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc); |
| 2393 | + _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc); |
| 2394 | + _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc); |
| 2395 | + _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc); |
| 2396 | + _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc); |
| 2397 | + |
| 2398 | + // Abbreviated month names, starting with "C"'s Jan. |
| 2399 | + _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc); |
| 2400 | + _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc); |
| 2401 | + _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc); |
| 2402 | + _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc); |
| 2403 | + _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc); |
| 2404 | + _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc); |
| 2405 | + _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc); |
| 2406 | + _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc); |
| 2407 | + _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc); |
| 2408 | + _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc); |
| 2409 | + _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc); |
| 2410 | + _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc); |
| 2411 | + } |
| 2412 | + } |
| 2413 | + |
| 2414 | +#ifdef _GLIBCXX_USE_WCHAR_T |
| 2415 | + template<> |
| 2416 | + void |
| 2417 | + __timepunct<wchar_t>:: |
| 2418 | + _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, |
| 2419 | + const tm* __tm) const |
| 2420 | + { |
| 2421 | +#ifdef __UCLIBC_HAS_XLOCALE__ |
| 2422 | + __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); |
| 2423 | + const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm, |
| 2424 | + _M_c_locale_timepunct); |
| 2425 | +#else |
| 2426 | + char* __old = strdup(setlocale(LC_ALL, NULL)); |
| 2427 | + setlocale(LC_ALL, _M_name_timepunct); |
| 2428 | + const size_t __len = wcsftime(__s, __maxlen, __format, __tm); |
| 2429 | + setlocale(LC_ALL, __old); |
| 2430 | + free(__old); |
| 2431 | +#endif |
| 2432 | + // Make sure __s is null terminated. |
| 2433 | + if (__len == 0) |
| 2434 | + __s[0] = L'\0'; |
| 2435 | + } |
| 2436 | + |
| 2437 | + template<> |
| 2438 | + void |
| 2439 | + __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc) |
| 2440 | + { |
| 2441 | + if (!_M_data) |
| 2442 | + _M_data = new __timepunct_cache<wchar_t>; |
| 2443 | + |
| 2444 | +#warning wide time stuff |
| 2445 | +// if (!__cloc) |
| 2446 | + { |
| 2447 | + // "C" locale |
| 2448 | + _M_c_locale_timepunct = _S_get_c_locale(); |
| 2449 | + |
| 2450 | + _M_data->_M_date_format = L"%m/%d/%y"; |
| 2451 | + _M_data->_M_date_era_format = L"%m/%d/%y"; |
| 2452 | + _M_data->_M_time_format = L"%H:%M:%S"; |
| 2453 | + _M_data->_M_time_era_format = L"%H:%M:%S"; |
| 2454 | + _M_data->_M_date_time_format = L""; |
| 2455 | + _M_data->_M_date_time_era_format = L""; |
| 2456 | + _M_data->_M_am = L"AM"; |
| 2457 | + _M_data->_M_pm = L"PM"; |
| 2458 | + _M_data->_M_am_pm_format = L""; |
| 2459 | + |
| 2460 | + // Day names, starting with "C"'s Sunday. |
| 2461 | + _M_data->_M_day1 = L"Sunday"; |
| 2462 | + _M_data->_M_day2 = L"Monday"; |
| 2463 | + _M_data->_M_day3 = L"Tuesday"; |
| 2464 | + _M_data->_M_day4 = L"Wednesday"; |
| 2465 | + _M_data->_M_day5 = L"Thursday"; |
| 2466 | + _M_data->_M_day6 = L"Friday"; |
| 2467 | + _M_data->_M_day7 = L"Saturday"; |
| 2468 | + |
| 2469 | + // Abbreviated day names, starting with "C"'s Sun. |
| 2470 | + _M_data->_M_aday1 = L"Sun"; |
| 2471 | + _M_data->_M_aday2 = L"Mon"; |
| 2472 | + _M_data->_M_aday3 = L"Tue"; |
| 2473 | + _M_data->_M_aday4 = L"Wed"; |
| 2474 | + _M_data->_M_aday5 = L"Thu"; |
| 2475 | + _M_data->_M_aday6 = L"Fri"; |
| 2476 | + _M_data->_M_aday7 = L"Sat"; |
| 2477 | + |
| 2478 | + // Month names, starting with "C"'s January. |
| 2479 | + _M_data->_M_month01 = L"January"; |
| 2480 | + _M_data->_M_month02 = L"February"; |
| 2481 | + _M_data->_M_month03 = L"March"; |
| 2482 | + _M_data->_M_month04 = L"April"; |
| 2483 | + _M_data->_M_month05 = L"May"; |
| 2484 | + _M_data->_M_month06 = L"June"; |
| 2485 | + _M_data->_M_month07 = L"July"; |
| 2486 | + _M_data->_M_month08 = L"August"; |
| 2487 | + _M_data->_M_month09 = L"September"; |
| 2488 | + _M_data->_M_month10 = L"October"; |
| 2489 | + _M_data->_M_month11 = L"November"; |
| 2490 | + _M_data->_M_month12 = L"December"; |
| 2491 | + |
| 2492 | + // Abbreviated month names, starting with "C"'s Jan. |
| 2493 | + _M_data->_M_amonth01 = L"Jan"; |
| 2494 | + _M_data->_M_amonth02 = L"Feb"; |
| 2495 | + _M_data->_M_amonth03 = L"Mar"; |
| 2496 | + _M_data->_M_amonth04 = L"Apr"; |
| 2497 | + _M_data->_M_amonth05 = L"May"; |
| 2498 | + _M_data->_M_amonth06 = L"Jun"; |
| 2499 | + _M_data->_M_amonth07 = L"Jul"; |
| 2500 | + _M_data->_M_amonth08 = L"Aug"; |
| 2501 | + _M_data->_M_amonth09 = L"Sep"; |
| 2502 | + _M_data->_M_amonth10 = L"Oct"; |
| 2503 | + _M_data->_M_amonth11 = L"Nov"; |
| 2504 | + _M_data->_M_amonth12 = L"Dec"; |
| 2505 | + } |
| 2506 | +#if 0 |
| 2507 | + else |
| 2508 | + { |
| 2509 | + _M_c_locale_timepunct = _S_clone_c_locale(__cloc); |
| 2510 | + |
| 2511 | + union { char *__s; wchar_t *__w; } __u; |
| 2512 | + |
| 2513 | + __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); |
| 2514 | + _M_data->_M_date_format = __u.__w; |
| 2515 | + __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); |
| 2516 | + _M_data->_M_date_era_format = __u.__w; |
| 2517 | + __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); |
| 2518 | + _M_data->_M_time_format = __u.__w; |
| 2519 | + __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); |
| 2520 | + _M_data->_M_time_era_format = __u.__w; |
| 2521 | + __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); |
| 2522 | + _M_data->_M_date_time_format = __u.__w; |
| 2523 | + __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); |
| 2524 | + _M_data->_M_date_time_era_format = __u.__w; |
| 2525 | + __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); |
| 2526 | + _M_data->_M_am = __u.__w; |
| 2527 | + __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); |
| 2528 | + _M_data->_M_pm = __u.__w; |
| 2529 | + __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); |
| 2530 | + _M_data->_M_am_pm_format = __u.__w; |
| 2531 | + |
| 2532 | + // Day names, starting with "C"'s Sunday. |
| 2533 | + __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); |
| 2534 | + _M_data->_M_day1 = __u.__w; |
| 2535 | + __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); |
| 2536 | + _M_data->_M_day2 = __u.__w; |
| 2537 | + __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); |
| 2538 | + _M_data->_M_day3 = __u.__w; |
| 2539 | + __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); |
| 2540 | + _M_data->_M_day4 = __u.__w; |
| 2541 | + __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); |
| 2542 | + _M_data->_M_day5 = __u.__w; |
| 2543 | + __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); |
| 2544 | + _M_data->_M_day6 = __u.__w; |
| 2545 | + __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); |
| 2546 | + _M_data->_M_day7 = __u.__w; |
| 2547 | + |
| 2548 | + // Abbreviated day names, starting with "C"'s Sun. |
| 2549 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); |
| 2550 | + _M_data->_M_aday1 = __u.__w; |
| 2551 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); |
| 2552 | + _M_data->_M_aday2 = __u.__w; |
| 2553 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); |
| 2554 | + _M_data->_M_aday3 = __u.__w; |
| 2555 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); |
| 2556 | + _M_data->_M_aday4 = __u.__w; |
| 2557 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); |
| 2558 | + _M_data->_M_aday5 = __u.__w; |
| 2559 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); |
| 2560 | + _M_data->_M_aday6 = __u.__w; |
| 2561 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); |
| 2562 | + _M_data->_M_aday7 = __u.__w; |
| 2563 | + |
| 2564 | + // Month names, starting with "C"'s January. |
| 2565 | + __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); |
| 2566 | + _M_data->_M_month01 = __u.__w; |
| 2567 | + __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); |
| 2568 | + _M_data->_M_month02 = __u.__w; |
| 2569 | + __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); |
| 2570 | + _M_data->_M_month03 = __u.__w; |
| 2571 | + __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); |
| 2572 | + _M_data->_M_month04 = __u.__w; |
| 2573 | + __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); |
| 2574 | + _M_data->_M_month05 = __u.__w; |
| 2575 | + __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); |
| 2576 | + _M_data->_M_month06 = __u.__w; |
| 2577 | + __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); |
| 2578 | + _M_data->_M_month07 = __u.__w; |
| 2579 | + __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); |
| 2580 | + _M_data->_M_month08 = __u.__w; |
| 2581 | + __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); |
| 2582 | + _M_data->_M_month09 = __u.__w; |
| 2583 | + __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); |
| 2584 | + _M_data->_M_month10 = __u.__w; |
| 2585 | + __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); |
| 2586 | + _M_data->_M_month11 = __u.__w; |
| 2587 | + __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); |
| 2588 | + _M_data->_M_month12 = __u.__w; |
| 2589 | + |
| 2590 | + // Abbreviated month names, starting with "C"'s Jan. |
| 2591 | + __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); |
| 2592 | + _M_data->_M_amonth01 = __u.__w; |
| 2593 | + __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); |
| 2594 | + _M_data->_M_amonth02 = __u.__w; |
| 2595 | + __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); |
| 2596 | + _M_data->_M_amonth03 = __u.__w; |
| 2597 | + __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); |
| 2598 | + _M_data->_M_amonth04 = __u.__w; |
| 2599 | + __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); |
| 2600 | + _M_data->_M_amonth05 = __u.__w; |
| 2601 | + __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); |
| 2602 | + _M_data->_M_amonth06 = __u.__w; |
| 2603 | + __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); |
| 2604 | + _M_data->_M_amonth07 = __u.__w; |
| 2605 | + __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); |
| 2606 | + _M_data->_M_amonth08 = __u.__w; |
| 2607 | + __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); |
| 2608 | + _M_data->_M_amonth09 = __u.__w; |
| 2609 | + __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); |
| 2610 | + _M_data->_M_amonth10 = __u.__w; |
| 2611 | + __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); |
| 2612 | + _M_data->_M_amonth11 = __u.__w; |
| 2613 | + __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); |
| 2614 | + _M_data->_M_amonth12 = __u.__w; |
| 2615 | + } |
| 2616 | +#endif // 0 |
| 2617 | + } |
| 2618 | +#endif |
| 2619 | +} |
| 2620 | --- /dev/null |
| 2621 | +++ b/libstdc++-v3/config/locale/uclibc/time_members.h |
| 2622 | @@ -0,0 +1,76 @@ |
| 2623 | +// std::time_get, std::time_put implementation, GNU version -*- C++ -*- |
| 2624 | + |
| 2625 | +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 2626 | +// |
| 2627 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 2628 | +// software; you can redistribute it and/or modify it under the |
| 2629 | +// terms of the GNU General Public License as published by the |
| 2630 | +// Free Software Foundation; either version 2, or (at your option) |
| 2631 | +// any later version. |
| 2632 | + |
| 2633 | +// This library is distributed in the hope that it will be useful, |
| 2634 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2635 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2636 | +// GNU General Public License for more details. |
| 2637 | + |
| 2638 | +// You should have received a copy of the GNU General Public License along |
| 2639 | +// with this library; see the file COPYING. If not, write to the Free |
| 2640 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 2641 | +// USA. |
| 2642 | + |
| 2643 | +// As a special exception, you may use this file as part of a free software |
| 2644 | +// library without restriction. Specifically, if other files instantiate |
| 2645 | +// templates or use macros or inline functions from this file, or you compile |
| 2646 | +// this file and link it with other files to produce an executable, this |
| 2647 | +// file does not by itself cause the resulting executable to be covered by |
| 2648 | +// the GNU General Public License. This exception does not however |
| 2649 | +// invalidate any other reasons why the executable file might be covered by |
| 2650 | +// the GNU General Public License. |
| 2651 | + |
| 2652 | +// |
| 2653 | +// ISO C++ 14882: 22.2.5.1.2 - time_get functions |
| 2654 | +// ISO C++ 14882: 22.2.5.3.2 - time_put functions |
| 2655 | +// |
| 2656 | + |
| 2657 | +// Written by Benjamin Kosnik <bkoz@redhat.com> |
| 2658 | + |
| 2659 | + template<typename _CharT> |
| 2660 | + __timepunct<_CharT>::__timepunct(size_t __refs) |
| 2661 | + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), |
| 2662 | + _M_name_timepunct(_S_get_c_name()) |
| 2663 | + { _M_initialize_timepunct(); } |
| 2664 | + |
| 2665 | + template<typename _CharT> |
| 2666 | + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) |
| 2667 | + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), |
| 2668 | + _M_name_timepunct(_S_get_c_name()) |
| 2669 | + { _M_initialize_timepunct(); } |
| 2670 | + |
| 2671 | + template<typename _CharT> |
| 2672 | + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, |
| 2673 | + size_t __refs) |
| 2674 | + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), |
| 2675 | + _M_name_timepunct(NULL) |
| 2676 | + { |
| 2677 | + const size_t __len = std::strlen(__s) + 1; |
| 2678 | + char* __tmp = new char[__len]; |
| 2679 | + std::memcpy(__tmp, __s, __len); |
| 2680 | + _M_name_timepunct = __tmp; |
| 2681 | + |
| 2682 | + try |
| 2683 | + { _M_initialize_timepunct(__cloc); } |
| 2684 | + catch(...) |
| 2685 | + { |
| 2686 | + delete [] _M_name_timepunct; |
| 2687 | + __throw_exception_again; |
| 2688 | + } |
| 2689 | + } |
| 2690 | + |
| 2691 | + template<typename _CharT> |
| 2692 | + __timepunct<_CharT>::~__timepunct() |
| 2693 | + { |
| 2694 | + if (_M_name_timepunct != _S_get_c_name()) |
| 2695 | + delete [] _M_name_timepunct; |
| 2696 | + delete _M_data; |
| 2697 | + _S_destroy_c_locale(_M_c_locale_timepunct); |
| 2698 | + } |
| 2699 | --- /dev/null |
| 2700 | +++ b/libstdc++-v3/config/os/uclibc/ctype_base.h |
| 2701 | @@ -0,0 +1,64 @@ |
| 2702 | +// Locale support -*- C++ -*- |
| 2703 | + |
| 2704 | +// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 |
| 2705 | +// Free Software Foundation, Inc. |
| 2706 | +// |
| 2707 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 2708 | +// software; you can redistribute it and/or modify it under the |
| 2709 | +// terms of the GNU General Public License as published by the |
| 2710 | +// Free Software Foundation; either version 2, or (at your option) |
| 2711 | +// any later version. |
| 2712 | + |
| 2713 | +// This library is distributed in the hope that it will be useful, |
| 2714 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2715 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2716 | +// GNU General Public License for more details. |
| 2717 | + |
| 2718 | +// You should have received a copy of the GNU General Public License along |
| 2719 | +// with this library; see the file COPYING. If not, write to the Free |
| 2720 | +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 2721 | +// USA. |
| 2722 | + |
| 2723 | +// As a special exception, you may use this file as part of a free software |
| 2724 | +// library without restriction. Specifically, if other files instantiate |
| 2725 | +// templates or use macros or inline functions from this file, or you compile |
| 2726 | +// this file and link it with other files to produce an executable, this |
| 2727 | +// file does not by itself cause the resulting executable to be covered by |
| 2728 | +// the GNU General Public License. This exception does not however |
| 2729 | +// invalidate any other reasons why the executable file might be covered by |
| 2730 | +// the GNU General Public License. |
| 2731 | + |
| 2732 | +// |
| 2733 | +// ISO C++ 14882: 22.1 Locales |
| 2734 | +// |
| 2735 | + |
| 2736 | +/** @file ctype_base.h |
| 2737 | + * This is an internal header file, included by other library headers. |
| 2738 | + * You should not attempt to use it directly. |
| 2739 | + */ |
| 2740 | + |
| 2741 | +// Information as gleaned from /usr/include/ctype.h |
| 2742 | + |
| 2743 | + /// @brief Base class for ctype. |
| 2744 | + struct ctype_base |
| 2745 | + { |
| 2746 | + // Note: In uClibc, the following two types depend on configuration. |
| 2747 | + |
| 2748 | + // Non-standard typedefs. |
| 2749 | + typedef const __ctype_touplow_t* __to_type; |
| 2750 | + |
| 2751 | + // NB: Offsets into ctype<char>::_M_table force a particular size |
| 2752 | + // on the mask type. Because of this, we don't use an enum. |
| 2753 | + typedef __ctype_mask_t mask; |
| 2754 | + static const mask upper = _ISupper; |
| 2755 | + static const mask lower = _ISlower; |
| 2756 | + static const mask alpha = _ISalpha; |
| 2757 | + static const mask digit = _ISdigit; |
| 2758 | + static const mask xdigit = _ISxdigit; |
| 2759 | + static const mask space = _ISspace; |
| 2760 | + static const mask print = _ISprint; |
| 2761 | + static const mask graph = _ISalpha | _ISdigit | _ISpunct; |
| 2762 | + static const mask cntrl = _IScntrl; |
| 2763 | + static const mask punct = _ISpunct; |
| 2764 | + static const mask alnum = _ISalpha | _ISdigit; |
| 2765 | + }; |
| 2766 | --- /dev/null |
| 2767 | +++ b/libstdc++-v3/config/os/uclibc/ctype_inline.h |
| 2768 | @@ -0,0 +1,69 @@ |
| 2769 | +// Locale support -*- C++ -*- |
| 2770 | + |
| 2771 | +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. |
| 2772 | +// |
| 2773 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 2774 | +// software; you can redistribute it and/or modify it under the |
| 2775 | +// terms of the GNU General Public License as published by the |
| 2776 | +// Free Software Foundation; either version 2, or (at your option) |
| 2777 | +// any later version. |
| 2778 | + |
| 2779 | +// This library is distributed in the hope that it will be useful, |
| 2780 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2781 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2782 | +// GNU General Public License for more details. |
| 2783 | + |
| 2784 | +// You should have received a copy of the GNU General Public License along |
| 2785 | +// with this library; see the file COPYING. If not, write to the Free |
| 2786 | +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 2787 | +// USA. |
| 2788 | + |
| 2789 | +// As a special exception, you may use this file as part of a free software |
| 2790 | +// library without restriction. Specifically, if other files instantiate |
| 2791 | +// templates or use macros or inline functions from this file, or you compile |
| 2792 | +// this file and link it with other files to produce an executable, this |
| 2793 | +// file does not by itself cause the resulting executable to be covered by |
| 2794 | +// the GNU General Public License. This exception does not however |
| 2795 | +// invalidate any other reasons why the executable file might be covered by |
| 2796 | +// the GNU General Public License. |
| 2797 | + |
| 2798 | +// |
| 2799 | +// ISO C++ 14882: 22.1 Locales |
| 2800 | +// |
| 2801 | + |
| 2802 | +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) |
| 2803 | +// functions go in ctype.cc |
| 2804 | + |
| 2805 | + bool |
| 2806 | + ctype<char>:: |
| 2807 | + is(mask __m, char __c) const |
| 2808 | + { return _M_table[static_cast<unsigned char>(__c)] & __m; } |
| 2809 | + |
| 2810 | + const char* |
| 2811 | + ctype<char>:: |
| 2812 | + is(const char* __low, const char* __high, mask* __vec) const |
| 2813 | + { |
| 2814 | + while (__low < __high) |
| 2815 | + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; |
| 2816 | + return __high; |
| 2817 | + } |
| 2818 | + |
| 2819 | + const char* |
| 2820 | + ctype<char>:: |
| 2821 | + scan_is(mask __m, const char* __low, const char* __high) const |
| 2822 | + { |
| 2823 | + while (__low < __high |
| 2824 | + && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) |
| 2825 | + ++__low; |
| 2826 | + return __low; |
| 2827 | + } |
| 2828 | + |
| 2829 | + const char* |
| 2830 | + ctype<char>:: |
| 2831 | + scan_not(mask __m, const char* __low, const char* __high) const |
| 2832 | + { |
| 2833 | + while (__low < __high |
| 2834 | + && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) |
| 2835 | + ++__low; |
| 2836 | + return __low; |
| 2837 | + } |
| 2838 | --- /dev/null |
| 2839 | +++ b/libstdc++-v3/config/os/uclibc/ctype_noninline.h |
| 2840 | @@ -0,0 +1,92 @@ |
| 2841 | +// Locale support -*- C++ -*- |
| 2842 | + |
| 2843 | +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 |
| 2844 | +// Free Software Foundation, Inc. |
| 2845 | +// |
| 2846 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 2847 | +// software; you can redistribute it and/or modify it under the |
| 2848 | +// terms of the GNU General Public License as published by the |
| 2849 | +// Free Software Foundation; either version 2, or (at your option) |
| 2850 | +// any later version. |
| 2851 | + |
| 2852 | +// This library is distributed in the hope that it will be useful, |
| 2853 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2854 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2855 | +// GNU General Public License for more details. |
| 2856 | + |
| 2857 | +// You should have received a copy of the GNU General Public License along |
| 2858 | +// with this library; see the file COPYING. If not, write to the Free |
| 2859 | +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 2860 | +// USA. |
| 2861 | + |
| 2862 | +// As a special exception, you may use this file as part of a free software |
| 2863 | +// library without restriction. Specifically, if other files instantiate |
| 2864 | +// templates or use macros or inline functions from this file, or you compile |
| 2865 | +// this file and link it with other files to produce an executable, this |
| 2866 | +// file does not by itself cause the resulting executable to be covered by |
| 2867 | +// the GNU General Public License. This exception does not however |
| 2868 | +// invalidate any other reasons why the executable file might be covered by |
| 2869 | +// the GNU General Public License. |
| 2870 | + |
| 2871 | +// |
| 2872 | +// ISO C++ 14882: 22.1 Locales |
| 2873 | +// |
| 2874 | + |
| 2875 | +// Information as gleaned from /usr/include/ctype.h |
| 2876 | + |
| 2877 | + const ctype_base::mask* |
| 2878 | + ctype<char>::classic_table() throw() |
| 2879 | + { return __C_ctype_b; } |
| 2880 | + |
| 2881 | + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, |
| 2882 | + size_t __refs) |
| 2883 | + : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), |
| 2884 | + _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) |
| 2885 | + { |
| 2886 | + _M_toupper = __C_ctype_toupper; |
| 2887 | + _M_tolower = __C_ctype_tolower; |
| 2888 | + _M_table = __table ? __table : __C_ctype_b; |
| 2889 | + memset(_M_widen, 0, sizeof(_M_widen)); |
| 2890 | + memset(_M_narrow, 0, sizeof(_M_narrow)); |
| 2891 | + } |
| 2892 | + |
| 2893 | + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) |
| 2894 | + : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), |
| 2895 | + _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) |
| 2896 | + { |
| 2897 | + _M_toupper = __C_ctype_toupper; |
| 2898 | + _M_tolower = __C_ctype_tolower; |
| 2899 | + _M_table = __table ? __table : __C_ctype_b; |
| 2900 | + memset(_M_widen, 0, sizeof(_M_widen)); |
| 2901 | + memset(_M_narrow, 0, sizeof(_M_narrow)); |
| 2902 | + } |
| 2903 | + |
| 2904 | + char |
| 2905 | + ctype<char>::do_toupper(char __c) const |
| 2906 | + { return _M_toupper[static_cast<unsigned char>(__c)]; } |
| 2907 | + |
| 2908 | + const char* |
| 2909 | + ctype<char>::do_toupper(char* __low, const char* __high) const |
| 2910 | + { |
| 2911 | + while (__low < __high) |
| 2912 | + { |
| 2913 | + *__low = _M_toupper[static_cast<unsigned char>(*__low)]; |
| 2914 | + ++__low; |
| 2915 | + } |
| 2916 | + return __high; |
| 2917 | + } |
| 2918 | + |
| 2919 | + char |
| 2920 | + ctype<char>::do_tolower(char __c) const |
| 2921 | + { return _M_tolower[static_cast<unsigned char>(__c)]; } |
| 2922 | + |
| 2923 | + const char* |
| 2924 | + ctype<char>::do_tolower(char* __low, const char* __high) const |
| 2925 | + { |
| 2926 | + while (__low < __high) |
| 2927 | + { |
| 2928 | + *__low = _M_tolower[static_cast<unsigned char>(*__low)]; |
| 2929 | + ++__low; |
| 2930 | + } |
| 2931 | + return __high; |
| 2932 | + } |
| 2933 | --- /dev/null |
| 2934 | +++ b/libstdc++-v3/config/os/uclibc/os_defines.h |
| 2935 | @@ -0,0 +1,44 @@ |
| 2936 | +// Specific definitions for GNU/Linux -*- C++ -*- |
| 2937 | + |
| 2938 | +// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
| 2939 | +// |
| 2940 | +// This file is part of the GNU ISO C++ Library. This library is free |
| 2941 | +// software; you can redistribute it and/or modify it under the |
| 2942 | +// terms of the GNU General Public License as published by the |
| 2943 | +// Free Software Foundation; either version 2, or (at your option) |
| 2944 | +// any later version. |
| 2945 | + |
| 2946 | +// This library is distributed in the hope that it will be useful, |
| 2947 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2948 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 2949 | +// GNU General Public License for more details. |
| 2950 | + |
| 2951 | +// You should have received a copy of the GNU General Public License along |
| 2952 | +// with this library; see the file COPYING. If not, write to the Free |
| 2953 | +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 2954 | +// USA. |
| 2955 | + |
| 2956 | +// As a special exception, you may use this file as part of a free software |
| 2957 | +// library without restriction. Specifically, if other files instantiate |
| 2958 | +// templates or use macros or inline functions from this file, or you compile |
| 2959 | +// this file and link it with other files to produce an executable, this |
| 2960 | +// file does not by itself cause the resulting executable to be covered by |
| 2961 | +// the GNU General Public License. This exception does not however |
| 2962 | +// invalidate any other reasons why the executable file might be covered by |
| 2963 | +// the GNU General Public License. |
| 2964 | + |
| 2965 | +#ifndef _GLIBCXX_OS_DEFINES |
| 2966 | +#define _GLIBCXX_OS_DEFINES 1 |
| 2967 | + |
| 2968 | +// System-specific #define, typedefs, corrections, etc, go here. This |
| 2969 | +// file will come before all others. |
| 2970 | + |
| 2971 | +// This keeps isanum, et al from being propagated as macros. |
| 2972 | +#define __NO_CTYPE 1 |
| 2973 | + |
| 2974 | +#include <features.h> |
| 2975 | + |
| 2976 | +// We must not see the optimized string functions GNU libc defines. |
| 2977 | +#define __NO_STRING_INLINES |
| 2978 | + |
| 2979 | +#endif |
| 2980 | --- a/libstdc++-v3/configure |
| 2981 | +++ b/libstdc++-v3/configure |
| 2982 | @@ -4005,6 +4005,11 @@ linux-gnu*) |
| 2983 | lt_cv_deplibs_check_method=pass_all |
| 2984 | ;; |
| 2985 | |
| 2986 | +linux-uclibc*) |
| 2987 | + lt_cv_deplibs_check_method=pass_all |
| 2988 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` |
| 2989 | + ;; |
| 2990 | + |
| 2991 | netbsd* | knetbsd*-gnu) |
| 2992 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then |
| 2993 | lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' |
| 2994 | @@ -5740,7 +5745,7 @@ if test "${enable_clocale+set}" = set; t |
| 2995 | enableval="$enable_clocale" |
| 2996 | |
| 2997 | case "$enableval" in |
| 2998 | - generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; |
| 2999 | + generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; |
| 3000 | *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 |
| 3001 | echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} |
| 3002 | { (exit 1); exit 1; }; } ;; |
| 3003 | @@ -5765,6 +5770,9 @@ fi; |
| 3004 | # Default to "generic". |
| 3005 | if test $enable_clocale_flag = auto; then |
| 3006 | case ${target_os} in |
| 3007 | + linux-uclibc*) |
| 3008 | + enable_clocale_flag=uclibc |
| 3009 | + ;; |
| 3010 | linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) |
| 3011 | cat >conftest.$ac_ext <<_ACEOF |
| 3012 | /* confdefs.h. */ |
| 3013 | @@ -5995,6 +6003,76 @@ echo "${ECHO_T}IEEE 1003.1" >&6 |
| 3014 | CTIME_CC=config/locale/generic/time_members.cc |
| 3015 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h |
| 3016 | ;; |
| 3017 | + uclibc) |
| 3018 | + echo "$as_me:$LINENO: result: uclibc" >&5 |
| 3019 | +echo "${ECHO_T}uclibc" >&6 |
| 3020 | + |
| 3021 | + # Declare intention to use gettext, and add support for specific |
| 3022 | + # languages. |
| 3023 | + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT |
| 3024 | + ALL_LINGUAS="de fr" |
| 3025 | + |
| 3026 | + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. |
| 3027 | + # Extract the first word of "msgfmt", so it can be a program name with args. |
| 3028 | +set dummy msgfmt; ac_word=$2 |
| 3029 | +echo "$as_me:$LINENO: checking for $ac_word" >&5 |
| 3030 | +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 |
| 3031 | +if test "${ac_cv_prog_check_msgfmt+set}" = set; then |
| 3032 | + echo $ECHO_N "(cached) $ECHO_C" >&6 |
| 3033 | +else |
| 3034 | + if test -n "$check_msgfmt"; then |
| 3035 | + ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. |
| 3036 | +else |
| 3037 | +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
| 3038 | +for as_dir in $PATH |
| 3039 | +do |
| 3040 | + IFS=$as_save_IFS |
| 3041 | + test -z "$as_dir" && as_dir=. |
| 3042 | + for ac_exec_ext in '' $ac_executable_extensions; do |
| 3043 | + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then |
| 3044 | + ac_cv_prog_check_msgfmt="yes" |
| 3045 | + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 |
| 3046 | + break 2 |
| 3047 | + fi |
| 3048 | +done |
| 3049 | +done |
| 3050 | + |
| 3051 | + test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" |
| 3052 | +fi |
| 3053 | +fi |
| 3054 | +check_msgfmt=$ac_cv_prog_check_msgfmt |
| 3055 | +if test -n "$check_msgfmt"; then |
| 3056 | + echo "$as_me:$LINENO: result: $check_msgfmt" >&5 |
| 3057 | +echo "${ECHO_T}$check_msgfmt" >&6 |
| 3058 | +else |
| 3059 | + echo "$as_me:$LINENO: result: no" >&5 |
| 3060 | +echo "${ECHO_T}no" >&6 |
| 3061 | +fi |
| 3062 | + |
| 3063 | + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then |
| 3064 | + USE_NLS=yes |
| 3065 | + fi |
| 3066 | + # Export the build objects. |
| 3067 | + for ling in $ALL_LINGUAS; do \ |
| 3068 | + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ |
| 3069 | + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ |
| 3070 | + done |
| 3071 | + |
| 3072 | + |
| 3073 | + |
| 3074 | + CLOCALE_H=config/locale/uclibc/c_locale.h |
| 3075 | + CLOCALE_CC=config/locale/uclibc/c_locale.cc |
| 3076 | + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc |
| 3077 | + CCOLLATE_CC=config/locale/uclibc/collate_members.cc |
| 3078 | + CCTYPE_CC=config/locale/uclibc/ctype_members.cc |
| 3079 | + CMESSAGES_H=config/locale/uclibc/messages_members.h |
| 3080 | + CMESSAGES_CC=config/locale/uclibc/messages_members.cc |
| 3081 | + CMONEY_CC=config/locale/uclibc/monetary_members.cc |
| 3082 | + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc |
| 3083 | + CTIME_H=config/locale/uclibc/time_members.h |
| 3084 | + CTIME_CC=config/locale/uclibc/time_members.cc |
| 3085 | + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h |
| 3086 | + ;; |
| 3087 | esac |
| 3088 | |
| 3089 | # This is where the testsuite looks for locale catalogs, using the |
| 3090 | --- a/libstdc++-v3/configure.host |
| 3091 | +++ b/libstdc++-v3/configure.host |
| 3092 | @@ -270,6 +270,12 @@ case "${host_os}" in |
| 3093 | ;; |
| 3094 | esac |
| 3095 | |
| 3096 | +# Override for uClibc since linux-uclibc gets mishandled above. |
| 3097 | +case "${host_os}" in |
| 3098 | + *-uclibc*) |
| 3099 | + os_include_dir="os/uclibc" |
| 3100 | + ;; |
| 3101 | +esac |
| 3102 | |
| 3103 | # Set any OS-dependent and CPU-dependent bits. |
| 3104 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. |
| 3105 | --- a/libstdc++-v3/crossconfig.m4 |
| 3106 | +++ b/libstdc++-v3/crossconfig.m4 |
| 3107 | @@ -143,6 +143,99 @@ case "${host}" in |
| 3108 | ;; |
| 3109 | esac |
| 3110 | ;; |
| 3111 | + *-uclibc*) |
| 3112 | +# Temporary hack until we implement the float versions of the libm funcs |
| 3113 | + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ |
| 3114 | + machine/endian.h machine/param.h sys/machine.h sys/types.h \ |
| 3115 | + fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) |
| 3116 | + SECTION_FLAGS='-ffunction-sections -fdata-sections' |
| 3117 | + AC_SUBST(SECTION_FLAGS) |
| 3118 | + GLIBCXX_CHECK_LINKER_FEATURES |
| 3119 | + GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT |
| 3120 | + GLIBCXX_CHECK_WCHAR_T_SUPPORT |
| 3121 | + |
| 3122 | + # For LFS. |
| 3123 | + AC_DEFINE(HAVE_INT64_T) |
| 3124 | + case "$target" in |
| 3125 | + *-uclinux*) |
| 3126 | + # Don't enable LFS with uClinux |
| 3127 | + ;; |
| 3128 | + *) |
| 3129 | + AC_DEFINE(_GLIBCXX_USE_LFS) |
| 3130 | + esac |
| 3131 | + |
| 3132 | + # For showmanyc_helper(). |
| 3133 | + AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) |
| 3134 | + GLIBCXX_CHECK_POLL |
| 3135 | + GLIBCXX_CHECK_S_ISREG_OR_S_IFREG |
| 3136 | + |
| 3137 | + # For xsputn_2(). |
| 3138 | + AC_CHECK_HEADERS(sys/uio.h) |
| 3139 | + GLIBCXX_CHECK_WRITEV |
| 3140 | + |
| 3141 | +# AC_DEFINE(HAVE_ACOSF) |
| 3142 | +# AC_DEFINE(HAVE_ASINF) |
| 3143 | +# AC_DEFINE(HAVE_ATANF) |
| 3144 | +# AC_DEFINE(HAVE_ATAN2F) |
| 3145 | + AC_DEFINE(HAVE_CEILF) |
| 3146 | + AC_DEFINE(HAVE_COPYSIGN) |
| 3147 | +# AC_DEFINE(HAVE_COPYSIGNF) |
| 3148 | +# AC_DEFINE(HAVE_COSF) |
| 3149 | +# AC_DEFINE(HAVE_COSHF) |
| 3150 | +# AC_DEFINE(HAVE_EXPF) |
| 3151 | +# AC_DEFINE(HAVE_FABSF) |
| 3152 | + AC_DEFINE(HAVE_FINITE) |
| 3153 | + AC_DEFINE(HAVE_FINITEF) |
| 3154 | + AC_DEFINE(HAVE_FLOORF) |
| 3155 | +# AC_DEFINE(HAVE_FMODF) |
| 3156 | +# AC_DEFINE(HAVE_FREXPF) |
| 3157 | + AC_DEFINE(HAVE_HYPOT) |
| 3158 | +# AC_DEFINE(HAVE_HYPOTF) |
| 3159 | + AC_DEFINE(HAVE_ISINF) |
| 3160 | + AC_DEFINE(HAVE_ISINFF) |
| 3161 | + AC_DEFINE(HAVE_ISNAN) |
| 3162 | + AC_DEFINE(HAVE_ISNANF) |
| 3163 | +# AC_DEFINE(HAVE_LOGF) |
| 3164 | +# AC_DEFINE(HAVE_LOG10F) |
| 3165 | +# AC_DEFINE(HAVE_MODFF) |
| 3166 | +# AC_DEFINE(HAVE_SINF) |
| 3167 | +# AC_DEFINE(HAVE_SINHF) |
| 3168 | +# AC_DEFINE(HAVE_SINCOS) |
| 3169 | +# AC_DEFINE(HAVE_SINCOSF) |
| 3170 | + AC_DEFINE(HAVE_SQRTF) |
| 3171 | +# AC_DEFINE(HAVE_TANF) |
| 3172 | +# AC_DEFINE(HAVE_TANHF) |
| 3173 | + if test x"long_double_math_on_this_cpu" = x"yes"; then |
| 3174 | + AC_MSG_ERROR([long_double_math_on_this_cpu is yes!]) |
| 3175 | +# AC_DEFINE(HAVE_ACOSL) |
| 3176 | +# AC_DEFINE(HAVE_ASINL) |
| 3177 | +# AC_DEFINE(HAVE_ATANL) |
| 3178 | +# AC_DEFINE(HAVE_ATAN2L) |
| 3179 | +# AC_DEFINE(HAVE_CEILL) |
| 3180 | +# AC_DEFINE(HAVE_COPYSIGNL) |
| 3181 | +# AC_DEFINE(HAVE_COSL) |
| 3182 | +# AC_DEFINE(HAVE_COSHL) |
| 3183 | +# AC_DEFINE(HAVE_EXPL) |
| 3184 | +# AC_DEFINE(HAVE_FABSL) |
| 3185 | +# AC_DEFINE(HAVE_FINITEL) |
| 3186 | +# AC_DEFINE(HAVE_FLOORL) |
| 3187 | +# AC_DEFINE(HAVE_FMODL) |
| 3188 | +# AC_DEFINE(HAVE_FREXPL) |
| 3189 | +# AC_DEFINE(HAVE_HYPOTL) |
| 3190 | +# AC_DEFINE(HAVE_ISINFL) |
| 3191 | +# AC_DEFINE(HAVE_ISNANL) |
| 3192 | +# AC_DEFINE(HAVE_LOGL) |
| 3193 | +# AC_DEFINE(HAVE_LOG10L) |
| 3194 | +# AC_DEFINE(HAVE_MODFL) |
| 3195 | +# AC_DEFINE(HAVE_POWL) |
| 3196 | +# AC_DEFINE(HAVE_SINL) |
| 3197 | +# AC_DEFINE(HAVE_SINHL) |
| 3198 | +# AC_DEFINE(HAVE_SINCOSL) |
| 3199 | +# AC_DEFINE(HAVE_SQRTL) |
| 3200 | +# AC_DEFINE(HAVE_TANL) |
| 3201 | +# AC_DEFINE(HAVE_TANHL) |
| 3202 | + fi |
| 3203 | + ;; |
| 3204 | *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) |
| 3205 | AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ |
| 3206 | machine/endian.h machine/param.h sys/machine.h sys/types.h \ |
| 3207 | @@ -157,7 +250,7 @@ case "${host}" in |
| 3208 | AC_DEFINE(HAVE_INT64_T) |
| 3209 | case "$target" in |
| 3210 | *-uclinux*) |
| 3211 | - # Don't enable LFS with uClibc |
| 3212 | + # Don't enable LFS with uClinux |
| 3213 | ;; |
| 3214 | *) |
| 3215 | AC_DEFINE(_GLIBCXX_USE_LFS) |
| 3216 | --- a/libstdc++-v3/include/c_compatibility/wchar.h |
| 3217 | +++ b/libstdc++-v3/include/c_compatibility/wchar.h |
| 3218 | @@ -101,7 +101,9 @@ using std::wmemcmp; |
| 3219 | using std::wmemcpy; |
| 3220 | using std::wmemmove; |
| 3221 | using std::wmemset; |
| 3222 | +#if _GLIBCXX_HAVE_WCSFTIME |
| 3223 | using std::wcsftime; |
| 3224 | +#endif |
| 3225 | |
| 3226 | #if _GLIBCXX_USE_C99 |
| 3227 | using std::wcstold; |
| 3228 | --- a/libstdc++-v3/include/c_std/std_cwchar.h |
| 3229 | +++ b/libstdc++-v3/include/c_std/std_cwchar.h |
| 3230 | @@ -180,7 +180,9 @@ namespace std |
| 3231 | using ::wcscoll; |
| 3232 | using ::wcscpy; |
| 3233 | using ::wcscspn; |
| 3234 | +#if _GLIBCXX_HAVE_WCSFTIME |
| 3235 | using ::wcsftime; |
| 3236 | +#endif |
| 3237 | using ::wcslen; |
| 3238 | using ::wcsncat; |
| 3239 | using ::wcsncmp; |
| 3240 | |