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