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