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