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