Magellan Linux

Contents of /trunk/gcc/patches/gcc-4.1.2-uclibc_locale-1.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 456 - (show annotations) (download)
Thu Jan 31 11:54:53 2008 UTC (16 years, 3 months ago) by niro
File size: 112617 byte(s)
-added uclibc patches

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