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