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