diff options
Diffstat (limited to 'contrib/libstdc++/config')
119 files changed, 10487 insertions, 0 deletions
diff --git a/contrib/libstdc++/config/cpu/alpha/bits/atomicity.h b/contrib/libstdc++/config/cpu/alpha/bits/atomicity.h new file mode 100644 index 0000000..895d87a --- /dev/null +++ b/contrib/libstdc++/config/cpu/alpha/bits/atomicity.h @@ -0,0 +1,76 @@ +// Low-level functions for atomic operations: Alpha version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +/* @@@ With gas we can play nice .subsection games to get the + non-predicted branch pointing forward. But Digital assemblers + don't understand those directives. This isn't a terribly + important issue, so just ignore it. */ + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) +{ + register int __result, __tmp; + + __asm__ __volatile__ ( + "\n$Lxadd_%=:\n\t" + "ldl_l %0,%3\n\t" + "addl %0,%4,%1\n\t" + "stl_c %1,%2\n\t" + "beq %1,$Lxadd_%=\n\t" + "mb" + : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) + : "m" (*__mem), "r"(__val)); + + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + register _Atomic_word __result; + + __asm__ __volatile__ ( + "\n$Ladd_%=:\n\t" + "ldl_l %0,%2\n\t" + "addl %0,%3,%0\n\t" + "stl_c %0,%1\n\t" + "beq %0,$Ladd_%=\n\t" + "mb" + : "=&r"(__result), "=m"(*__mem) + : "m" (*__mem), "r"(__val)); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/alpha/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/alpha/bits/cpu_limits.h new file mode 100644 index 0000000..21d31e3 --- /dev/null +++ b/contrib/libstdc++/config/cpu/alpha/bits/cpu_limits.h @@ -0,0 +1,38 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_bits 64 + +#define __glibcpp_long_double_bits 64 + +#endif + + + diff --git a/contrib/libstdc++/config/cpu/arm/bits/atomicity.h b/contrib/libstdc++/config/cpu/arm/bits/atomicity.h new file mode 100644 index 0000000..2363edf --- /dev/null +++ b/contrib/libstdc++/config/cpu/arm/bits/atomicity.h @@ -0,0 +1,221 @@ +// Low-level functions for atomic operations: ARM version -*- C++ -*- + +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __tmp, __tmp2, __result; +#ifdef __thumb__ + /* Since this function is inlined, we can't be sure of the alignment. */ + __asm__ __volatile__ ( + "ldr %0, 4f \n\t" + "bx %0 \n\t" + ".align 0 \n" + "4:\t" + ".word 0f \n\t" + ".code 32 \n" + "0:\t" + "ldr %0, [%3] \n\t" + "add %1, %0, %4 \n\t" + "swp %2, %1, [%3] \n\t" + "cmp %0, %2 \n\t" + "swpne %1, %2, [%3] \n\t" + "bne 0b \n\t" + "ldr %1, 1f \n\t" + "bx %1 \n" + "1:\t" + ".word 2f \n\t" + ".code 16 \n" + "2:\n" + : "=&l"(__result), "=&r"(__tmp), "=&r"(__tmp2) + : "r" (__mem), "r"(__val) + : "cc", "memory"); +#else + __asm__ __volatile__ ( + "\n" + "0:\t" + "ldr %0, [%3] \n\t" + "add %1, %0, %4 \n\t" + "swp %2, %1, [%3] \n\t" + "cmp %0, %2 \n\t" + "swpne %1, %2, [%3] \n\t" + "bne 0b \n\t" + "" + : "=&r"(__result), "=&r"(__tmp), "=&r"(__tmp2) + : "r" (__mem), "r"(__val) + : "cc", "memory"); +#endif + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __tmp, __tmp2, __tmp3; +#ifdef __thumb__ + /* Since this function is inlined, we can't be sure of the alignment. */ + __asm__ __volatile__ ( + "ldr %0, 4f \n\t" + "bx %0 \n\t" + ".align 0\n" + "4:\t" + ".word 0f \n\t" + ".code 32 \n" + "0:\t" + "ldr %0, [%3] \n\t" + "add %1, %0, %4 \n\t" + "swp %2, %1, [%3] \n\t" + "cmp %0, %2 \n\t" + "swpne %1, %2,[%3] \n\t" + "bne 0b \n\t" + "ldr %1, 1f \n\t" + "bx %1 \n" + "1:\t" + ".word 2f \n\t" + ".code 16 \n" + "2:\n" + : "=&l"(__tmp), "=&r"(__tmp2), "=&r"(__tmp3) + : "r" (__mem), "r"(__val) + : "cc", "memory"); +#else + __asm__ __volatile__ ( + "\n" + "0:\t" + "ldr %0, [%3] \n\t" + "add %1, %0, %4 \n\t" + "swp %2, %1, [%3] \n\t" + "cmp %0, %2 \n\t" + "swpne %1, %2, [%3] \n\t" + "bne 0b \n\t" + "" + : "=&r"(__tmp), "=&r"(__tmp2), "=&r"(__tmp3) + : "r" (__mem), "r"(__val) + : "cc", "memory"); +#endif +} + +static inline long +__attribute__ ((__unused__)) +__always_swap (volatile long *__p, long __newval) +{ + long __result; +#ifdef __thumb__ + long __tmp; + /* Since this function is inlined, we can't be sure of the alignment. */ + __asm__ __volatile__ ( + "ldr %0, 4f \n\t" + "bx %0 \n\t" + ".align 0 \n" + "4:\t" + ".word 0f \n\t" + ".code 32\n" + "0:\t" + "swp %0, %3, [%2] \n\t" + "ldr %1, 1f \n\t" + "bx %1 \n" + "1:\t" + ".word 2f \n\t" + ".code 16 \n" + "2:\n" + : "=&l"(__result), "=&r"(__tmp) + : "r"(__p), "r"(__newval) + : "memory"); +#else + __asm__ __volatile__ ( + "\n\t" + "swp %0, %2, [%1] \n\t" + "" + : "=&r"(__result) + : "r"(__p), "r"(__newval) + : "memory"); +#endif + return __result; +} + +static inline int +__attribute__ ((__unused__)) +__test_and_set (volatile long *__p, long __newval) +{ + int __result; + long __tmp; +#ifdef __thumb__ + /* Since this function is inlined, we can't be sure of the alignment. */ + __asm__ __volatile__ ( + "ldr %0, 4f \n\t" + "bx %0 \n\t" + ".align 0 \n" + "4:\t" + ".word 0f \n\t" + ".code 32 \n" + "0:\t" + "ldr %0, [%2] \n\t" + "cmp %0, #0 \n\t" + "bne 1f \n\t" + "swp %1, %3, [%2] \n\t" + "cmp %0, %1 \n\t" + "swpne %0, %1, [%2]\n\t" + "bne 0b \n" + "1:\t" + "ldr %1, 2f \n\t" + "bx %1 \n" + "2:\t" + ".word 3f \n\t" + ".code 16 \n" + "3:" + : "=&l"(__result), "=r" (__tmp) + : "r"(__p), "r"(__newval) + : "cc", "memory"); +#else + __asm__ __volatile__ ( + "\n" + "0:\t" + "ldr %0, [%2] \n\t" + "cmp %0, #0 \n\t" + "bne 1f \n\t" + "swp %1, %3, [%2] \n\t" + "cmp %0, %1 \n\t" + "swpne %0, %1, [%2] \n\t" + "bne 0b \n" + "1:\n\t" + "" + : "=&r"(__result), "=r" (__tmp) + : "r"(__p), "r"(__newval) + : "cc", "memory"); +#endif + return __result; +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/cris/bits/atomicity.h b/contrib/libstdc++/config/cpu/cris/bits/atomicity.h new file mode 100644 index 0000000..55c374f --- /dev/null +++ b/contrib/libstdc++/config/cpu/cris/bits/atomicity.h @@ -0,0 +1,79 @@ +// Low-level functions for atomic operations: CRIS version -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +// This entity must not cross a page boundary. +typedef int _Atomic_word __attribute__ ((__aligned__ (4))); + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (_Atomic_word* __mem, int __val) +{ + int __tmp; + _Atomic_word __result; + +#if (__CRIS_arch_version >= 10) + __asm__ __volatile__ (" clearf \n" + "0: \n" + " move.d %4,%2 \n" + " move.d [%3],%0 \n" + " add.d %0,%2 \n" + " ax \n" + " move.d %2,[%3] \n" + " bwf 0b \n" + " clearf \n" + : "=&r" (__result), "=m" (*__mem), "=&r" (__tmp) + : "r" (__mem), "g" (__val), "m" (*__mem) + : "memory"); +#else + __asm__ __volatile__ (" move $ccr,$r9 \n" + " di \n" + " move.d %4,%2 \n" + " move.d [%3],%0 \n" + " add.d %0,%2 \n" + " move.d %2,[%3] \n" + " move $r9,$ccr \n" + : "=&r" (__result), "=m" (*__mem), "=&r" (__tmp) + : "r" (__mem), "g" (__val), "m" (*__mem) + : "memory", "r9"); +#endif + + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (_Atomic_word* __mem, int __val) +{ + __exchange_and_add (__mem, __val); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/cris/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/cris/bits/cpu_limits.h new file mode 100644 index 0000000..f0ff04d --- /dev/null +++ b/contrib/libstdc++/config/cpu/cris/bits/cpu_limits.h @@ -0,0 +1,33 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_double_bits 64 + +#endif diff --git a/contrib/libstdc++/config/cpu/generic/bits/atomicity.h b/contrib/libstdc++/config/cpu/generic/bits/atomicity.h new file mode 100644 index 0000000..fca2b83 --- /dev/null +++ b/contrib/libstdc++/config/cpu/generic/bits/atomicity.h @@ -0,0 +1,51 @@ +// Low-level functions for atomic operations: Generic version -*- C++ -*- + +// Copyright (C) 1999, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (_Atomic_word* __mem, int __val) +{ + _Atomic_word __result = *__mem; + *__mem += __val; + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (_Atomic_word* __mem, int __val) +{ + *__mem += __val; +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/generic/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/generic/bits/cpu_limits.h new file mode 100644 index 0000000..0438f7c --- /dev/null +++ b/contrib/libstdc++/config/cpu/generic/bits/cpu_limits.h @@ -0,0 +1,41 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +// Nothing is defined in the generic file. In that way, we fall back +// on the defaults in std_limits.h. + +// If you need to override these defaults, you can either use a +// CPU-specific version (in which case you must modify +// configure.target) or you must add the overrides to your +// os_defines.h. In general, if all systems for your CPU use the +// same values, it is best to use a cpu-specific configuration file. + +#endif + diff --git a/contrib/libstdc++/config/cpu/generic/bits/limits.h b/contrib/libstdc++/config/cpu/generic/bits/limits.h new file mode 100644 index 0000000..8fa5a82 --- /dev/null +++ b/contrib/libstdc++/config/cpu/generic/bits/limits.h @@ -0,0 +1,40 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +// Nothing is defined in the generic file. In that way, we fall back +// on the defaults in std_limits.h. + +// If you need to override these defaults, you can either use a +// CPU-specific version (in which case you must modify +// configure.target) or you must add the overrides to your +// os_defines.h. In general, if all systems for your CPU use the +// same values, it is best to use a cpu-specific configuration file. + +#endif diff --git a/contrib/libstdc++/config/cpu/i386/bits/atomicity.h b/contrib/libstdc++/config/cpu/i386/bits/atomicity.h new file mode 100644 index 0000000..4733503 --- /dev/null +++ b/contrib/libstdc++/config/cpu/i386/bits/atomicity.h @@ -0,0 +1,59 @@ +// Low-level functions for atomic operations: x86, x < 4 version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __result; + __asm__ __volatile__ ("lock; xaddl %0,%2" + : "=r" (__result) + : "0" (__val), "m" (*__mem) + : "memory"); + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + __asm__ __volatile__ ("lock; addl %0,%1" + : : "ir" (__val), "m" (*__mem) : "memory"); +} + +#endif /* atomicity.h */ + + + + diff --git a/contrib/libstdc++/config/cpu/i386/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/i386/bits/cpu_limits.h new file mode 100644 index 0000000..be304e2 --- /dev/null +++ b/contrib/libstdc++/config/cpu/i386/bits/cpu_limits.h @@ -0,0 +1,33 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_double_bits 80 + +#endif diff --git a/contrib/libstdc++/config/cpu/i486/bits/atomicity.h b/contrib/libstdc++/config/cpu/i486/bits/atomicity.h new file mode 100644 index 0000000..92f5011 --- /dev/null +++ b/contrib/libstdc++/config/cpu/i486/bits/atomicity.h @@ -0,0 +1,57 @@ +// Low-level functions for atomic operations: x86, x >= 4 version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __result; + __asm__ __volatile__ ("lock; xaddl %0,%2" + : "=r" (__result) + : "0" (__val), "m" (*__mem) + : "memory"); + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + __asm__ __volatile__ ("lock; addl %0,%1" + : : "ir" (__val), "m" (*__mem) : "memory"); +} + +#endif /* atomicity.h */ + + diff --git a/contrib/libstdc++/config/cpu/ia64/bits/atomicity.h b/contrib/libstdc++/config/cpu/ia64/bits/atomicity.h new file mode 100644 index 0000000..e28e149 --- /dev/null +++ b/contrib/libstdc++/config/cpu/ia64/bits/atomicity.h @@ -0,0 +1,51 @@ +// Low-level functions for atomic operations: IA64 version -*- C++ -*- + +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +#include <ia64intrin.h> + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + return __sync_fetch_and_add (__mem, __val); +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + __sync_fetch_and_add (__mem, __val); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/ia64/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/ia64/bits/cpu_limits.h new file mode 100644 index 0000000..735f7d5 --- /dev/null +++ b/contrib/libstdc++/config/cpu/ia64/bits/cpu_limits.h @@ -0,0 +1,36 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_bits 64 + +// While sizeof(long double) == 16, the format is the same as the x86. +#define __glibcpp_long_double_bits 80 + +#endif diff --git a/contrib/libstdc++/config/cpu/m68k/bits/atomicity.h b/contrib/libstdc++/config/cpu/m68k/bits/atomicity.h new file mode 100644 index 0000000..c5d3394 --- /dev/null +++ b/contrib/libstdc++/config/cpu/m68k/bits/atomicity.h @@ -0,0 +1,158 @@ +// Low-level functions for atomic operations: m68k version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +#if defined(__mc68020__) || defined(__mc68030__) \ + || defined(__mc68040__) || defined(__mc68060__) +// These variants support compare-and-swap. + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __result = *__mem; + register _Atomic_word __temp; + __asm__ __volatile__ ("1: move%.l %0,%1\n\t" + "add%.l %2,%1\n\t" + "cas%.l %0,%1,%3\n\t" + "jbne 1b" + : "=d" (__result), "=&d" (__temp) + : "d" (__val), "m" (*__mem), "0" (__result) + : "memory"); + return __result; +} + +#elif defined(__rtems__) + /* + * TAS/JBNE is unsafe on systems with strict priority-based scheduling. + * Disable interrupts, which we can do only from supervisor mode. + */ +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __result; + short __level, __tmpsr; + __asm__ __volatile__ ("move%.w %%sr,%0\n\tor%.l %0,%1\n\tmove%.w %1,%%sr" + : "=d"(__level), "=d"(__tmpsr) : "1"(0x700)); + + __result = *__mem; + *__mem = __result + __val; + + __asm__ __volatile__ ("move%.w %0,%%sr" : : "d"(__level)); + + return __result; +} + +#elif !defined(__mcf5200__) && !defined(__mcf5300__) +// 68000, 68010, cpu32 and 5400 support test-and-set. + +template <int __inst> +struct __Atomicity_lock +{ + static volatile unsigned char _S_atomicity_lock; +}; + +template <int __inst> +volatile unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0; + +template volatile unsigned char __Atomicity_lock<0>::_S_atomicity_lock; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __result; + + __asm__ __volatile__("1: tas %0\n\tjbne 1b" + : "=m"(__Atomicity_lock<0>::_S_atomicity_lock) + : "m"(__Atomicity_lock<0>::_S_atomicity_lock)); + + __result = *__mem; + *__mem = __result + __val; + + __Atomicity_lock<0>::_S_atomicity_lock = 0; + + return __result; +} + +#elif defined(__vxWorks__) || defined(__embedded__) +// The best we can hope for is to disable interrupts, which we +// can only do from supervisor mode. + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __result; + short __level, __tmpsr; + __asm__ __volatile__ ("move%.w %%sr,%0\n\tor%.l %0,%1\n\tmove%.w %1,%%sr" + : "=d"(__level), "=d"(__tmpsr) : "1"(0x700)); + + __result = *__mem; + *__mem = __result + __val; + + __asm__ __volatile__ ("move%.w %0,%%sr" : : "d"(__level)); + + return __result; +} + +#else +// These variants do not support any atomic operations at all. + +#warning "__exchange_and_add is not atomic for this target" + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __result; + + __result = *__mem; + *__mem = __result + __val; + + return __result; +} + +#endif /* CAS / IRQ / TAS */ + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + // Careful: using add.l with a memory destination is not + // architecturally guaranteed to be atomic. + (void) __exchange_and_add (__mem, __val); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/m68k/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/m68k/bits/cpu_limits.h new file mode 100644 index 0000000..07e4e03 --- /dev/null +++ b/contrib/libstdc++/config/cpu/m68k/bits/cpu_limits.h @@ -0,0 +1,35 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_double_bits 96 + +#endif + + diff --git a/contrib/libstdc++/config/cpu/mips/bits/atomicity.h b/contrib/libstdc++/config/cpu/mips/bits/atomicity.h new file mode 100644 index 0000000..7878c6e --- /dev/null +++ b/contrib/libstdc++/config/cpu/mips/bits/atomicity.h @@ -0,0 +1,78 @@ +// Low-level functions for atomic operations. MIPS II version. + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +// #include <sgidefs.h> +// #ifdef (_MIPS_ISA_MIPS2) + +typedef int _Atomic_word; + +static inline int +__attribute__ ((unused)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + int __result, __tmp; + + __asm__ __volatile__ + ("/* Inline exchange & add */\n\t" + "1:\n\t" + "ll %0,%3\n\t" + "addu %1,%4,%0\n\t" + "sc %1,%2\n\t" + "beqz %1,1b\n\t" + "/* End exchange & add */" + : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) + : "m" (*__mem), "r"(__val) + : "memory"); + + return __result; +} + +static inline void +__attribute__ ((unused)) +__atomic_add (volatile _Atomic_word *__mem, int __val) +{ + int __result; + + __asm__ __volatile__ + ("/* Inline atomic add */\n\t" + "1:\n\t" + "ll %0,%2\n\t" + "addu %0,%3,%0\n\t" + "sc %0,%1\n\t" + "beqz %0,1b\n\t" + "/* End atomic add */" + : "=&r"(__result), "=m"(*__mem) + : "m" (*__mem), "r"(__val) + : "memory"); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/mmix/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/mmix/bits/cpu_limits.h new file mode 100644 index 0000000..e40ce97 --- /dev/null +++ b/contrib/libstdc++/config/cpu/mmix/bits/cpu_limits.h @@ -0,0 +1,34 @@ +// Copyright (C) 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_bits 64 +#define __glibcpp_long_double_bits 64 + +#endif diff --git a/contrib/libstdc++/config/cpu/powerpc/bits/atomicity.h b/contrib/libstdc++/config/cpu/powerpc/bits/atomicity.h new file mode 100644 index 0000000..05addba --- /dev/null +++ b/contrib/libstdc++/config/cpu/powerpc/bits/atomicity.h @@ -0,0 +1,112 @@ +// Low-level functions for atomic operations: PowerPC version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __tmp, __res; + __asm__ __volatile__ ( + "/* Inline exchange & add */\n" + "0:\t" + "lwarx %0,0,%2 \n\t" + "add%I3 %1,%0,%3 \n\t" + "stwcx. %1,0,%2 \n\t" + "bne- 0b \n\t" + "/* End exchange & add */" + : "=&b"(__res), "=&r"(__tmp) + : "r" (__mem), "Ir"(__val) + : "cr0", "memory"); + return __res; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __tmp; + __asm__ __volatile__ ( + "/* Inline atomic add */\n" + "0:\t" + "lwarx %0,0,%1 \n\t" + "add%I2 %0,%0,%2 \n\t" + "stwcx. %0,0,%1 \n\t" + "bne- 0b \n\t" + "/* End atomic add */" + : "=&b"(__tmp) + : "r" (__mem), "Ir"(__val) + : "cr0", "memory"); +} + +static inline long +__attribute__ ((__unused__)) +__always_swap (volatile long *__p, long int __newval) +{ + long __res; + __asm__ __volatile__ ( + "/* Inline always swap */\n" + "0:\t" + "lwarx %0,0,%1 \n\t" + "stwcx. %2,0,%1 \n\t" + "bne- 0b \n\t" + "/* End always swap */" + : "=&r"(__res) + : "r"(__p), "r"(__newval) + : "cr0", "memory"); + return __res; +} + +static inline int +__attribute__ ((__unused__)) +__test_and_set (volatile long *__p, long int __newval) +{ + int __res; + __asm__ __volatile__ ( + "/* Inline test & set */\n" + "0:\t" + "lwarx %0,0,%1 \n\t" + "cmpwi %0,0 \n\t" + "bne- 1f \n\t" + "stwcx. %2,0,%1 \n\t" + "bne- 0b \n" + "1:\n\t" + "/* End test & set */" + : "=&r"(__res) + : "r"(__p), "r"(__newval) + : "cr0", "memory"); + return __res; +} + +#endif /* atomicity.h */ + diff --git a/contrib/libstdc++/config/cpu/powerpc/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/powerpc/bits/cpu_limits.h new file mode 100644 index 0000000..87d7883 --- /dev/null +++ b/contrib/libstdc++/config/cpu/powerpc/bits/cpu_limits.h @@ -0,0 +1,38 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#ifndef __LONG_DOUBLE_128__ +#define __glibcpp_long_double_bits 64 +#endif + +#endif + + + diff --git a/contrib/libstdc++/config/cpu/s390/bits/atomicity.h b/contrib/libstdc++/config/cpu/s390/bits/atomicity.h new file mode 100644 index 0000000..331c29a --- /dev/null +++ b/contrib/libstdc++/config/cpu/s390/bits/atomicity.h @@ -0,0 +1,60 @@ +// Low-level functions for atomic operations: S/390 version -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __old_val, __new_val; + + __asm__ __volatile__ (" l %0,0(%2)\n" + "0: lr %1,%0\n" + " ar %1,%3\n" + " cs %0,%1,0(%2)\n" + " jl 0b" + : "=&d" (__old_val), "=&d" (__new_val) + : "a" (__mem), "d" (__val) : "cc", "memory" ); + return __old_val; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word *__mem, int __val) +{ + __exchange_and_add (__mem, __val); +} + +#endif /* atomicity.h */ + + diff --git a/contrib/libstdc++/config/cpu/s390/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/s390/bits/cpu_limits.h new file mode 100644 index 0000000..f0ff04d --- /dev/null +++ b/contrib/libstdc++/config/cpu/s390/bits/cpu_limits.h @@ -0,0 +1,33 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_double_bits 64 + +#endif diff --git a/contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h b/contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h new file mode 100644 index 0000000..aa639e4 --- /dev/null +++ b/contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h @@ -0,0 +1,88 @@ +// Low-level functions for atomic operations: Sparc32 version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +template <int __inst> +struct __Atomicity_lock +{ + static unsigned char _S_atomicity_lock; +}; + +template <int __inst> +unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0; + +template unsigned char __Atomicity_lock<0>::_S_atomicity_lock; + +static int +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __result, __tmp; + + __asm__ __volatile__("1: ldstub [%1], %0\n\t" + " cmp %0, 0\n\t" + " bne 1b\n\t" + " nop" + : "=&r" (__tmp) + : "r" (&__Atomicity_lock<0>::_S_atomicity_lock) + : "memory"); + __result = *__mem; + *__mem += __val; + __asm__ __volatile__("stb %%g0, [%0]" + : /* no outputs */ + : "r" (&__Atomicity_lock<0>::_S_atomicity_lock) + : "memory"); + return __result; +} + +static void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __tmp; + + __asm__ __volatile__("1: ldstub [%1], %0\n\t" + " cmp %0, 0\n\t" + " bne 1b\n\t" + " nop" + : "=&r" (__tmp) + : "r" (&__Atomicity_lock<0>::_S_atomicity_lock) + : "memory"); + *__mem += __val; + __asm__ __volatile__("stb %%g0, [%0]" + : /* no outputs */ + : "r" (&__Atomicity_lock<0>::_S_atomicity_lock) + : "memory"); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h b/contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h new file mode 100644 index 0000000..e13ca82 --- /dev/null +++ b/contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h @@ -0,0 +1,70 @@ +// Low-level functions for atomic operations: Sparc64 version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef long _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __tmp1, __tmp2; + + __asm__ __volatile__("1: ldx [%2], %0\n\t" + " add %0, %3, %1\n\t" + " casx [%2], %0, %1\n\t" + " sub %0, %1, %0\n\t" + " brnz,pn %0, 1b\n\t" + " nop" + : "=&r" (__tmp1), "=&r" (__tmp2) + : "r" (__mem), "r" (__val) + : "memory"); + return __tmp2; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __tmp1, __tmp2; + + __asm__ __volatile__("1: ldx [%2], %0\n\t" + " add %0, %3, %1\n\t" + " casx [%2], %0, %1\n\t" + " sub %0, %1, %0\n\t" + " brnz,pn %0, 1b\n\t" + " nop" + : "=&r" (__tmp1), "=&r" (__tmp2) + : "r" (__mem), "r" (__val) + : "memory"); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/x86-64/bits/atomicity.h b/contrib/libstdc++/config/cpu/x86-64/bits/atomicity.h new file mode 100644 index 0000000..15ff07f --- /dev/null +++ b/contrib/libstdc++/config/cpu/x86-64/bits/atomicity.h @@ -0,0 +1,55 @@ +// Low-level functions for atomic operations: AMD x86-64, -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __result; + __asm__ __volatile__ ("lock; xaddl %0,%2" + : "=r" (__result) + : "0" (__val), "m" (*__mem) + : "memory"); + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + __asm__ __volatile__ ("lock; addl %0,%1" + : : "ir" (__val), "m" (*__mem) : "memory"); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/x86-64/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/x86-64/bits/cpu_limits.h new file mode 100644 index 0000000..7de187e --- /dev/null +++ b/contrib/libstdc++/config/cpu/x86-64/bits/cpu_limits.h @@ -0,0 +1,35 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_bits 64 + +#define __glibcpp_long_double_bits 80 + +#endif diff --git a/contrib/libstdc++/config/io/basic_file_libio.cc b/contrib/libstdc++/config/io/basic_file_libio.cc new file mode 100644 index 0000000..60eb006 --- /dev/null +++ b/contrib/libstdc++/config/io/basic_file_libio.cc @@ -0,0 +1,194 @@ +// Wrapper of C-language FILE struct -*- C++ -*- + +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 27.8 File-based streams +// + +#include <bits/basic_file.h> + +namespace std +{ + // __basic_file<char> definitions + __basic_file<char>::__basic_file(__c_lock* __lock) + { +#ifdef _IO_MTSAFE_IO + _lock = __lock; +#endif + // Don't set the orientation of the stream when initializing. +#ifdef _GLIBCPP_USE_WCHAR_T + _IO_no_init(this, 0, 0, &_M_wfile, 0); +#else /* !defined(_GLIBCPP_USE_WCHAR_T) */ + _IO_no_init(this, 0, 0, NULL, 0); +#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */ + _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_file_jumps; + _IO_file_init((_IO_FILE_plus*)this); + } + + // NB: Unused. + int + __basic_file<char>::overflow(int __c) + { return _IO_file_overflow(this, __c); } + + // NB: Unused. + int + __basic_file<char>::underflow() + { return _IO_file_underflow(this); } + + // NB: Unused. + int + __basic_file<char>::uflow() + { return _IO_default_uflow(this); } + + // NB: Unused. + int + __basic_file<char>::pbackfail(int __c) + { return _IO_default_pbackfail(this, __c); } + + streamsize + __basic_file<char>::xsputn(const char* __s, streamsize __n) + { return _IO_file_xsputn(this, __s, __n); } + + streamoff + __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way, + ios_base::openmode __mode) + { return _IO_file_seekoff(this, __off, __way, __mode); } + + streamoff + __basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode) + { return _IO_file_seekoff(this, __pos, ios_base::beg, __mode); } + + // NB: Unused. + streambuf* + __basic_file<char>::setbuf(char* __b, int __len) + { return (streambuf*) _IO_file_setbuf(this,__b, __len); } + + int + __basic_file<char>::sync() + { return _IO_file_sync(this); } + + // NB: Unused. + int + __basic_file<char>::doallocate() + { return _IO_file_doallocate(this); } + + // __basic_file<wchar_t> definitions +#ifdef _GLIBCPP_USE_WCHAR_T + __basic_file<wchar_t>::__basic_file(__c_lock* __lock) + { +#ifdef _IO_MTSAFE_IO + _lock = __lock; +#endif + // Don't set the orientation of the stream when initializing. + _IO_no_init(this, 0, 0, &_M_wfile, &_IO_wfile_jumps); + _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_wfile_jumps; + _IO_file_init((_IO_FILE_plus*)this); + + // In addition, need to allocate the buffer... + _IO_wdoallocbuf(this); + // Setup initial positions for this buffer... + // if (!(_flags & _IO_NO_READS)) + _IO_wsetg(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base, + _wide_data->_IO_buf_base); + // if (!(_flags & _IO_NO_WRITES)) + _IO_wsetp(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base); + + // Setup codecvt bits... + _codecvt = &__c_libio_codecvt; + + // Do the same for narrow bits... + if (_IO_write_base == NULL) + { + _IO_doallocbuf(this); + // if (!(_flags & _IO_NO_READS)) + _IO_setg(this, _IO_buf_base, _IO_buf_base, _IO_buf_base); + // if (!(_flags & _IO_NO_WRITES)) + _IO_setp(this, _IO_buf_base, _IO_buf_base); + } + } + + int + __basic_file<wchar_t>::overflow(int __c) + { return _IO_wfile_overflow(this, __c); } + + int + __basic_file<wchar_t>::underflow() + { return _IO_wfile_underflow(this); } + + // NB: Unused. + int + __basic_file<wchar_t>::uflow() + { return _IO_wdefault_uflow(this); } + + // NB: Unused. + int + __basic_file<wchar_t>::pbackfail(int __c) + { return _IO_wdefault_pbackfail(this, __c); } + + streamsize + __basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n) + { return _IO_wfile_xsputn(this, __s, __n); } + + streamoff + __basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way, + ios_base::openmode __mode) + { return _IO_wfile_seekoff(this, __off, __way, __mode); } + + streamoff + __basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode) + { return _IO_wfile_seekoff(this, __pos, ios_base::beg, __mode); } + + streambuf* + __basic_file<wchar_t>::setbuf(wchar_t* __b, int __len) + { return (streambuf*) _IO_wfile_setbuf(this,__b, __len); } + + int + __basic_file<wchar_t>::sync() + { return _IO_wfile_sync(this); } + + int + __basic_file<wchar_t>::doallocate() + { return _IO_wfile_doallocate(this); } +#endif + + // Need to instantiate base class here for type-info bits, etc + template struct __basic_file_base<char>; + template class __basic_file<char>; +#ifdef _GLIBCPP_USE_WCHAR_T + template struct __basic_file_base<wchar_t>; + template class __basic_file<wchar_t>; +#endif +} // namespace std + + + + + + + diff --git a/contrib/libstdc++/config/io/basic_file_libio.h b/contrib/libstdc++/config/io/basic_file_libio.h new file mode 100644 index 0000000..57d83c4 --- /dev/null +++ b/contrib/libstdc++/config/io/basic_file_libio.h @@ -0,0 +1,498 @@ +// Wrapper of C-language FILE struct -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 27.8 File-based streams +// + +/** @file basic_file.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + +#ifndef _CPP_BASIC_FILE +#define _CPP_BASIC_FILE 1 + +#pragma GCC system_header + +#include <bits/c++config.h> +#include <ios> +#include <libioP.h> + +namespace std +{ + // Ulrich is going to make some detailed comment here, explaining + // all this unpleasantness, providing detailed performance analysis + // as to why we have to do all this lame vtable hacking instead of a + // sane, function-based approach. This verbiage will provide a clear + // and detailed description of the whole object-layout, + // vtable-swapping, sordid history of this hack. + template<typename _CharT> + struct __basic_file_base: public __c_file_type + { + virtual + ~__basic_file_base() { }; + + virtual int + overflow(int __c = EOF) = 0; + + virtual int + underflow() = 0; + + virtual int + uflow() = 0; + + virtual int + pbackfail(int __c) = 0; + + virtual streamsize + xsputn(const _CharT* __s, streamsize __n) = 0; + + virtual streamsize + xsgetn(_CharT* __s, streamsize __n) = 0; + + virtual streamoff + seekoff(streamoff __off, ios_base::seekdir __way, + ios_base::openmode __mode = ios_base::in | ios_base::out) = 0; + + virtual streamoff + seekpos(streamoff __pos, + ios_base::openmode __mode = ios_base::in | ios_base::out) = 0; + + virtual streambuf* + setbuf(_CharT* __b, int __len) = 0; + + virtual int + sync() = 0; + + virtual int + doallocate() = 0; + + virtual streamsize + sys_read(_CharT* __s, streamsize __n) = 0; + + virtual streamsize + sys_write(const _CharT* __s, streamsize __n) = 0; + + virtual streamoff + sys_seek(streamoff __off, ios_base::seekdir __way) = 0; + + virtual int + sys_close() = 0; + + virtual int + sys_stat(void* __v) = 0; + + virtual int + showmanyc() = 0; + + virtual void + imbue(void* __v) = 0; + }; + + // Some of these member functions are based on libio/filebuf.cc. + // Also note that the order and number of virtual functions has to precisely + // match the order and number in the _IO_jump_t struct defined in libioP.h. + template<typename _CharT> + class __basic_file: public __basic_file_base<_CharT> + { +# ifdef _GLIBCPP_USE_WCHAR_T + __c_wfile_type _M_wfile; +# endif + + public: + __basic_file(__c_lock* __lock = 0); + + void + _M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode, + char* __c_mode); + + // Equivalent to the normal fopen function. + __basic_file* + open(const char* __name, ios_base::openmode __mode, int __prot = 0664); + + // Used for opening the standard streams, cin, cout, cerr, clog, + // and their wide-stream equivalents. Instead of calling open, it + // just sets + // - for libio: __c_file_type->_fileno and the respective _flags bits + // - for stdio: _M_cfile = __file and some internal flags + // and returns. + __basic_file* + sys_open(__c_file_type* __file, ios_base::openmode __mode); + + _CharT + sys_getc(); + + _CharT + sys_ungetc(_CharT); + + __basic_file* + close(); + + bool + is_open(); + + int + fd(); + + // NB: Must match FILE specific jump table starting here--this + // means all virtual functions starting with the dtor must match, + // slot by slot. For glibc-based dystems, this means the _IO_FILE + // as the FILE struct and _IO_jump_t as the jump table. + virtual + ~__basic_file(); // Takes the place of __finish. + + virtual int + overflow(int __c = EOF); + + virtual int + underflow(); + + virtual int + uflow(); + + virtual int + pbackfail(int __c); + + // A complex "write" function that sets all of __c_file_type's + // pointers and associated data members correctly and manages its + // relation to the external byte sequence. + virtual streamsize + xsputn(const _CharT* __s, streamsize __n); + + // A complex "read" function that sets all of __c_file_type's + // pointers and associated data members correctly and manages its + // relation to the external byte sequence. + virtual streamsize + xsgetn(_CharT* __s, streamsize __n); + + // A complex "seekoff" function that sets all of __c_file_type's + // pointers and associated data members correctly and manages its + // relation to the external byte sequence. + virtual streamoff + seekoff(streamoff __off, ios_base::seekdir __way, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + // A complex "seekpos" function that sets all of __c_file_type's + // pointers and associated data members correctly and manages its + // relation to the external byte sequence. + virtual streamoff + seekpos(streamoff __pos, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + virtual streambuf* + setbuf(_CharT* __b, int __len); + + virtual int + sync(); + + virtual int + doallocate(); + + // A simple read function for the external byte sequence, that + // does no mucking around with or setting of the pointers or flags + // in __c_file_type. + virtual streamsize + sys_read(_CharT* __s, streamsize __n); + + // A simple write function for the external byte sequence, that + // does no mucking around with or setting of the pointers or flags + // in __c_file_type. + virtual streamsize + sys_write(const _CharT* __s, streamsize __n); + + // A simple seek function for the external byte sequence, that + // does no mucking around with or setting of the pointers or flags + // in __c_file_type. + virtual streamoff + sys_seek(streamoff __off, ios_base::seekdir __way); + + virtual int + sys_close(); + + virtual int + sys_stat(void* __v); + + virtual int + showmanyc(); + + virtual void + imbue(void* __v); + }; + + // __basic_file<char> specializations + template<> + __basic_file<char>::__basic_file(__c_lock* __lock); + + template<> + int + __basic_file<char>::overflow(int __c); + + template<> + int + __basic_file<char>::underflow(); + + template<> + int + __basic_file<char>::uflow(); + + template<> + int + __basic_file<char>::pbackfail(int __c); + + template<> + streamsize + __basic_file<char>::xsputn(const char* __s, streamsize __n); + + template<> + streamoff + __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way, + ios_base::openmode __mode); + + template<> + streamoff + __basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode); + + template<> + streambuf* + __basic_file<char>::setbuf(char* __b, int __len); + + template<> + int + __basic_file<char>::sync(); + + template<> + int + __basic_file<char>::doallocate(); + + // __basic_file<wchar_t> specializations +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + __basic_file<wchar_t>::__basic_file(__c_lock* __lock); + + template<> + int + __basic_file<wchar_t>::overflow(int __c); + + template<> + int + __basic_file<wchar_t>::underflow(); + + template<> + int + __basic_file<wchar_t>::uflow(); + + template<> + int + __basic_file<wchar_t>::pbackfail(int __c); + + template<> + streamsize + __basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n); + + template<> + streamoff + __basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way, + ios_base::openmode __mode); + + template<> + streamoff + __basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode); + + template<> + streambuf* + __basic_file<wchar_t>::setbuf(wchar_t* __b, int __len); + + template<> + int + __basic_file<wchar_t>::sync(); + + template<> + int + __basic_file<wchar_t>::doallocate(); +#endif + + template<typename _CharT> + __basic_file<_CharT>::~__basic_file() + { _IO_file_finish(this, 0); } + + template<typename _CharT> + void + __basic_file<_CharT>::_M_open_mode(ios_base::openmode __mode, + int& __p_mode, int& __rw_mode, + char* /*__c_mode*/) + { +#ifdef O_BINARY + bool __testb = __mode & ios_base::binary; +#endif + bool __testi = __mode & ios_base::in; + bool __testo = __mode & ios_base::out; + bool __testt = __mode & ios_base::trunc; + bool __testa = __mode & ios_base::app; + + if (!__testi && __testo && !__testt && !__testa) + { + __p_mode = O_WRONLY | O_TRUNC | O_CREAT; + __rw_mode = _IO_NO_READS; + } + if (!__testi && __testo && !__testt && __testa) + { + __p_mode = O_WRONLY | O_APPEND | O_CREAT; + __rw_mode = _IO_NO_READS | _IO_IS_APPENDING; + } + if (!__testi && __testo && __testt && !__testa) + { + __p_mode = O_WRONLY | O_TRUNC | O_CREAT; + __rw_mode = _IO_NO_READS; + } + if (__testi && !__testo && !__testt && !__testa) + { + __p_mode = O_RDONLY; + __rw_mode = _IO_NO_WRITES; + } + if (__testi && __testo && !__testt && !__testa) + { + __p_mode = O_RDWR; + __rw_mode = 0; + } + if (__testi && __testo && __testt && !__testa) + { + __p_mode = O_RDWR | O_TRUNC | O_CREAT; + __rw_mode = 0; + } +#ifdef O_BINARY + if (__testb) + __p_mode |= O_BINARY; +#endif + } + + template<typename _CharT> + __basic_file<_CharT>* + __basic_file<_CharT>::sys_open(__c_file_type* __f, + ios_base::openmode __mode) + { + __basic_file* __ret = NULL; + int __fd = fileno(__f); + int __p_mode = 0; + int __rw_mode = _IO_NO_READS + _IO_NO_WRITES; + char __c_mode[4]; + + _M_open_mode(__mode, __p_mode, __rw_mode, __c_mode); + + if (!_IO_file_is_open(this)) + { + _fileno = __fd; + _flags &= ~(_IO_NO_READS + _IO_NO_WRITES); + _flags |= _IO_DELETE_DONT_CLOSE; + _offset = _IO_pos_BAD; + int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING; + _IO_mask_flags(this, __rw_mode, __mask); + } + + return __ret; + } + + template<typename _CharT> + __basic_file<_CharT>* + __basic_file<_CharT>::open(const char* __name, ios_base::openmode __mode, + int __prot) + { + __basic_file* __ret = NULL; + int __p_mode = 0; + int __rw_mode = _IO_NO_READS + _IO_NO_WRITES; + char __c_mode[4]; + + _M_open_mode(__mode, __p_mode, __rw_mode, __c_mode); + if (!_IO_file_is_open(this)) + { + __c_file_type* __f; + __f = _IO_file_open(this, __name, __p_mode, __prot, __rw_mode, 0); + __ret = __f ? this: NULL; + } + return __ret; + } + + template<typename _CharT> + bool + __basic_file<_CharT>::is_open() { return _fileno >= 0; } + + template<typename _CharT> + __basic_file<_CharT>* + __basic_file<_CharT>::close() + { + return _IO_file_close_it(this) ? static_cast<__basic_file*>(NULL) : this; + } + + template<typename _CharT> + streamsize + __basic_file<_CharT>::xsgetn(_CharT* __s, streamsize __n) + { return _IO_file_xsgetn(this, __s, __n); } + + // NB: Unused. + template<typename _CharT> + streamsize + __basic_file<_CharT>::sys_read(_CharT* __s, streamsize __n) + { return _IO_file_read(this, __s, __n); } + + // NB: Unused. + template<typename _CharT> + streamsize + __basic_file<_CharT>::sys_write(const _CharT* __s, streamsize __n) + { return _IO_file_write(this, __s, __n); } + + // NB: Unused. + template<typename _CharT> + streamoff + __basic_file<_CharT>::sys_seek(streamoff __pos, ios_base::seekdir __way) + { return _IO_file_seek(this, __pos, __way); } + + // NB: Unused. + template<typename _CharT> + int + __basic_file<_CharT>::sys_close() + { return _IO_file_close(this); } + + // NB: Unused. + template<typename _CharT> + int + __basic_file<_CharT>::sys_stat(void* __v) + { return _IO_file_stat(this, __v); } + + // NB: Unused. + template<typename _CharT> + int + __basic_file<_CharT>::showmanyc() { return EOF; } + + // NB: Unused. + template<typename _CharT> + void + __basic_file<_CharT>::imbue(void* /*__v*/) { } +} // namespace std + +#endif // _CPP_BASIC_FILE diff --git a/contrib/libstdc++/config/io/basic_file_stdio.cc b/contrib/libstdc++/config/io/basic_file_stdio.cc new file mode 100644 index 0000000..93ca6bc --- /dev/null +++ b/contrib/libstdc++/config/io/basic_file_stdio.cc @@ -0,0 +1,187 @@ +// Wrapper of C-language FILE struct -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 27.8 File-based streams +// + +#include <bits/basic_file.h> + +namespace std +{ + // Definitions for __basic_file<char>. + __basic_file<char>::__basic_file(__c_lock* /*__lock*/) + : _M_cfile(NULL), _M_cfile_created(false) { } + + __basic_file<char>::~__basic_file() + { this->close(); } + + void + __basic_file<char>::_M_open_mode(ios_base::openmode __mode, int&, int&, + char* __c_mode) + { + bool __testb = __mode & ios_base::binary; + bool __testi = __mode & ios_base::in; + bool __testo = __mode & ios_base::out; + bool __testt = __mode & ios_base::trunc; + bool __testa = __mode & ios_base::app; + + if (!__testi && __testo && !__testt && !__testa) + strcpy(__c_mode, "w"); + if (!__testi && __testo && !__testt && __testa) + strcpy(__c_mode, "a"); + if (!__testi && __testo && __testt && !__testa) + strcpy(__c_mode, "w"); + if (__testi && !__testo && !__testt && !__testa) + strcpy(__c_mode, "r"); + if (__testi && __testo && !__testt && !__testa) + strcpy(__c_mode, "r+"); + if (__testi && __testo && __testt && !__testa) + strcpy(__c_mode, "w+"); + if (__testb) + strcat(__c_mode, "b"); + } + + __basic_file<char>* + __basic_file<char>::sys_open(__c_file* __file, ios_base::openmode) + { + __basic_file* __ret = NULL; + if (!this->is_open() && __file) + { + _M_cfile = __file; + _M_cfile_created = false; + __ret = this; + } + return __ret; + } + + __basic_file<char>* + __basic_file<char>::sys_open(int __fd, ios_base::openmode __mode, + bool __del) + { + __basic_file* __ret = NULL; + int __p_mode = 0; + int __rw_mode = 0; + char __c_mode[4]; + + _M_open_mode(__mode, __p_mode, __rw_mode, __c_mode); + if (!this->is_open() && (_M_cfile = fdopen(__fd, __c_mode))) + { + // Iff __del is true, then close will fclose the fd. + _M_cfile_created = __del; + + if (__fd == 0) + setvbuf(_M_cfile, reinterpret_cast<char*>(NULL), _IONBF, 0); + + __ret = this; + } + return __ret; + } + + int + __basic_file<char>::sys_getc() + { return getc(_M_cfile); } + + int + __basic_file<char>::sys_ungetc(int __c) + { return ungetc(__c, _M_cfile); } + + __basic_file<char>* + __basic_file<char>::open(const char* __name, ios_base::openmode __mode, + int /*__prot*/) + { + __basic_file* __ret = NULL; + int __p_mode = 0; + int __rw_mode = 0; + char __c_mode[4]; + + _M_open_mode(__mode, __p_mode, __rw_mode, __c_mode); + + if (!this->is_open()) + { + if ((_M_cfile = fopen(__name, __c_mode))) + { + _M_cfile_created = true; + __ret = this; + } + } + return __ret; + } + + bool + __basic_file<char>::is_open() const + { return _M_cfile != 0; } + + int + __basic_file<char>::fd() + { return fileno(_M_cfile) ; } + + __basic_file<char>* + __basic_file<char>::close() + { + __basic_file* __retval = static_cast<__basic_file*>(NULL); + if (this->is_open()) + { + fflush(_M_cfile); + if ((_M_cfile_created && fclose(_M_cfile) == 0) || !_M_cfile_created) + { + _M_cfile = 0; + __retval = this; + } + } + return __retval; + } + + streamsize + __basic_file<char>::xsgetn(char* __s, streamsize __n) + { return fread(__s, 1, __n, _M_cfile); } + + streamsize + __basic_file<char>::xsputn(const char* __s, streamsize __n) + { return fwrite(__s, 1, __n, _M_cfile); } + + streamoff + __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way, + ios_base::openmode /*__mode*/) + { + fseek(_M_cfile, __off, __way); + return ftell(_M_cfile); + } + + streamoff + __basic_file<char>::seekpos(streamoff __pos, ios_base::openmode /*__mode*/) + { + fseek(_M_cfile, __pos, ios_base::beg); + return ftell(_M_cfile); + } + + int + __basic_file<char>::sync() + { return fflush(_M_cfile); } +} // namespace std diff --git a/contrib/libstdc++/config/io/basic_file_stdio.h b/contrib/libstdc++/config/io/basic_file_stdio.h new file mode 100644 index 0000000..fe6edbb --- /dev/null +++ b/contrib/libstdc++/config/io/basic_file_stdio.h @@ -0,0 +1,114 @@ +// Wrapper of C-language FILE struct -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 27.8 File-based streams +// + +/** @file basic_file.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + +#ifndef _CPP_BASIC_FILE +#define _CPP_BASIC_FILE 1 + +#pragma GCC system_header + +#include <bits/c++config.h> +#include <ios> + +namespace std +{ + // Generic declaration. + template<typename _CharT> + class __basic_file; + + // Specialization. + template<> + class __basic_file<char> + { + // Underlying data source/sink. + __c_file* _M_cfile; + // True iff we opened _M_cfile, and thus must close it ourselves. + bool _M_cfile_created; + + public: + __basic_file(__c_lock* __lock = 0); + + void + _M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode, + char* __c_mode); + + __basic_file* + open(const char* __name, ios_base::openmode __mode, int __prot = 0664); + + __basic_file* + sys_open(__c_file* __file, ios_base::openmode); + + __basic_file* + sys_open(int __fd, ios_base::openmode __mode, bool __del); + + int + sys_getc(); + + int + sys_ungetc(int); + + __basic_file* + close(); + + bool + is_open() const; + + int + fd(); + + ~__basic_file(); + + streamsize + xsputn(const char* __s, streamsize __n); + + streamsize + xsgetn(char* __s, streamsize __n); + + streamoff + seekoff(streamoff __off, ios_base::seekdir __way, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + streamoff + seekpos(streamoff __pos, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + int + sync(); + }; +} // namespace std + +#endif // _CPP_BASIC_FILE diff --git a/contrib/libstdc++/config/io/c_io_libio.h b/contrib/libstdc++/config/io/c_io_libio.h new file mode 100644 index 0000000..acf6520 --- /dev/null +++ b/contrib/libstdc++/config/io/c_io_libio.h @@ -0,0 +1,113 @@ +// underlying io library -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// c_io_libio.h - Defines for using the GNU libio + +#ifndef _CPP_IO_LIBIO_H +#define _CPP_IO_LIBIO_H 1 + +#include <libio.h> + +namespace std +{ +// from fpos.h + typedef _IO_ssize_t streamsize; // Signed integral type + typedef _IO_ssize_t wstreamsize; + +#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 + typedef _IO_off64_t streamoff; + typedef _IO_fpos64_t __c_streampos; +#else + typedef _IO_off_t streamoff; + typedef _IO_fpos_t __c_streampos; +#endif + +#ifdef _GLIBCPP_USE_THREADS + typedef _IO_lock_t __c_lock; +#else + typedef int __c_lock; +#endif + +// from basic_file.h + typedef _IO_FILE __c_file_type; + typedef _IO_wide_data __c_wfile_type; + +#ifdef _GLIBCPP_USE_WCHAR_T + extern "C" _IO_codecvt __c_libio_codecvt; +#endif + +// from ios_base.h + struct __ios_flags + { + typedef short __int_type; + + static const __int_type _S_boolalpha = _IO_BAD_SEEN; + static const __int_type _S_dec = _IO_DEC; + static const __int_type _S_fixed = _IO_FIXED; + static const __int_type _S_hex = _IO_HEX; + static const __int_type _S_internal = _IO_INTERNAL; + static const __int_type _S_left = _IO_LEFT; + static const __int_type _S_oct = _IO_OCT; + static const __int_type _S_right = _IO_RIGHT; + static const __int_type _S_scientific = _IO_SCIENTIFIC; + static const __int_type _S_showbase = _IO_SHOWBASE; + static const __int_type _S_showpoint = _IO_SHOWPOINT; + static const __int_type _S_showpos = _IO_SHOWPOS; + static const __int_type _S_skipws = _IO_SKIPWS; + static const __int_type _S_unitbuf = _IO_UNITBUF; + static const __int_type _S_uppercase = _IO_UPPERCASE; + static const __int_type _S_adjustfield = _IO_LEFT | _IO_RIGHT + | _IO_INTERNAL; + static const __int_type _S_basefield = _IO_DEC | _IO_OCT | _IO_HEX; + static const __int_type _S_floatfield = _IO_SCIENTIFIC | _IO_FIXED; + + // 27.4.2.1.3 Type ios_base::iostate + static const __int_type _S_badbit = _IO_BAD_SEEN; + static const __int_type _S_eofbit = _IO_EOF_SEEN; + static const __int_type _S_failbit = _IO_ERR_SEEN; + + // 27.4.2.1.4 Type openmode + static const __int_type _S_app = _IOS_APPEND; + static const __int_type _S_ate = _IOS_ATEND; + static const __int_type _S_bin = _IOS_BIN; + static const __int_type _S_in = _IOS_INPUT; + static const __int_type _S_out = _IOS_OUTPUT; + static const __int_type _S_trunc = _IOS_TRUNC; + }; +} + +#endif // _CPP_IO_LIBIO_H + + + + + + + + diff --git a/contrib/libstdc++/config/io/c_io_libio_codecvt.c b/contrib/libstdc++/config/io/c_io_libio_codecvt.c new file mode 100644 index 0000000..38d8b55 --- /dev/null +++ b/contrib/libstdc++/config/io/c_io_libio_codecvt.c @@ -0,0 +1,153 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ + +/* Slightly modified from glibc/libio/iofwide.c */ + +#include <libio.h> + +#ifdef _GLIBCPP_USE_WCHAR_T + +/* Prototypes of libio's codecvt functions. */ +static enum __codecvt_result +do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, + const wchar_t *from_start, const wchar_t *from_end, + const wchar_t **from_stop, char *to_start, char *to_end, + char **to_stop); + +static enum __codecvt_result +do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, char *to_start, + char *to_end, char **to_stop); + +static enum __codecvt_result +do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, + const char *from_start, const char *from_end, const char **from_stop, + wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop); + +static int +do_encoding(struct _IO_codecvt *codecvt); + +static int +do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, + const char *from_start, const char *from_end, _IO_size_t max); + +static int +do_max_length(struct _IO_codecvt *codecvt); + +static int +do_always_noconv(struct _IO_codecvt *codecvt); + + +/* The functions used in `codecvt' for libio are always the same. */ +struct _IO_codecvt __c_libio_codecvt = +{ + .__codecvt_destr = NULL, /* Destructor, never used. */ + .__codecvt_do_out = do_out, + .__codecvt_do_unshift = do_unshift, + .__codecvt_do_in = do_in, + .__codecvt_do_encoding = do_encoding, + .__codecvt_do_always_noconv = do_always_noconv, + .__codecvt_do_length = do_length, + .__codecvt_do_max_length = do_max_length +}; + +static enum __codecvt_result +do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, + const wchar_t *from_start, const wchar_t *from_end, + const wchar_t **from_stop, char *to_start, char *to_end, + char **to_stop) +{ + enum __codecvt_result res = __codecvt_ok; + + while (from_start < from_end) + { + if (to_start >= to_end) + { + res = __codecvt_partial; + break; + } + *to_start++ = (char) *from_start++; + } + + *from_stop = from_start; + *to_stop = to_start; + + return res; +} + + +static enum __codecvt_result +do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, + char *to_start, char *to_end, char **to_stop) +{ + *to_stop = to_start; + return __codecvt_ok; +} + + +static enum __codecvt_result +do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, + const char *from_start, const char *from_end, const char **from_stop, + wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop) +{ + enum __codecvt_result res = __codecvt_ok; + + while (from_start < from_end) + { + if (to_start >= to_end) + { + res = __codecvt_partial; + break; + } + *to_start++ = (wchar_t) *from_start++; + } + + *from_stop = from_start; + *to_stop = to_start; + + return res; +} + + +static int +do_encoding(struct _IO_codecvt *codecvt) +{ return 1; } + + +static int +do_always_noconv(struct _IO_codecvt *codecvt) +{ return 0; } + + +static int +do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, + const char *from_start, const char *from_end, _IO_size_t max) +{ return from_end - from_start; } + + +static int +do_max_length(struct _IO_codecvt *codecvt) +{ return 1; } + +#endif /* _GLIBCPP_USE_WCHAR_T */ diff --git a/contrib/libstdc++/config/io/c_io_stdio.h b/contrib/libstdc++/config/io/c_io_stdio.h new file mode 100644 index 0000000..0d11d14 --- /dev/null +++ b/contrib/libstdc++/config/io/c_io_stdio.h @@ -0,0 +1,93 @@ +// underlying io library -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// c_io_stdio.h - Defines for using "C" stdio.h + +#ifndef _CPP_IO_STDIO_H +#define _CPP_IO_STDIO_H 1 + +#include <cstdio> +#include <cstddef> +#include <bits/gthr.h> + +namespace std +{ +// for fpos.h + typedef long streamoff; + typedef ptrdiff_t streamsize; // Signed integral type +#if _GLIBCPP_USE_WCHAR_T + typedef ptrdiff_t wstreamsize; +#endif + typedef fpos_t __c_streampos; + + typedef __gthread_mutex_t __c_lock; + +// for basic_file.h + typedef FILE __c_file; + +// for ios_base.h + struct __ios_flags + { + typedef short __int_type; + + static const __int_type _S_boolalpha = 0x0001; + static const __int_type _S_dec = 0x0002; + static const __int_type _S_fixed = 0x0004; + static const __int_type _S_hex = 0x0008; + static const __int_type _S_internal = 0x0010; + static const __int_type _S_left = 0x0020; + static const __int_type _S_oct = 0x0040; + static const __int_type _S_right = 0x0080; + static const __int_type _S_scientific = 0x0100; + static const __int_type _S_showbase = 0x0200; + static const __int_type _S_showpoint = 0x0400; + static const __int_type _S_showpos = 0x0800; + static const __int_type _S_skipws = 0x1000; + static const __int_type _S_unitbuf = 0x2000; + static const __int_type _S_uppercase = 0x4000; + static const __int_type _S_adjustfield = 0x0020 | 0x0080 | 0x0010; + static const __int_type _S_basefield = 0x0002 | 0x0040 | 0x0008; + static const __int_type _S_floatfield = 0x0100 | 0x0004; + + // 27.4.2.1.3 Type ios_base::iostate + static const __int_type _S_badbit = 0x01; + static const __int_type _S_eofbit = 0x02; + static const __int_type _S_failbit = 0x04; + + // 27.4.2.1.4 Type openmode + static const __int_type _S_app = 0x01; + static const __int_type _S_ate = 0x02; + static const __int_type _S_bin = 0x04; + static const __int_type _S_in = 0x08; + static const __int_type _S_out = 0x10; + static const __int_type _S_trunc = 0x20; + }; +} + +#endif // _CPP_IO_STDIO_H diff --git a/contrib/libstdc++/config/linker-map.dummy b/contrib/libstdc++/config/linker-map.dummy new file mode 100644 index 0000000..58e1413 --- /dev/null +++ b/contrib/libstdc++/config/linker-map.dummy @@ -0,0 +1,7 @@ +# +# This is a placeholder file. It does nothing and is not used. +# +# If you are seeing this file as your linker script (named linker.map), then +# either 1) the configuration process determined that symbol versioning should +# not be done, or 2) you specifically turned it off. +# diff --git a/contrib/libstdc++/config/linker-map.gnu b/contrib/libstdc++/config/linker-map.gnu new file mode 100644 index 0000000..2a55bb2 --- /dev/null +++ b/contrib/libstdc++/config/linker-map.gnu @@ -0,0 +1,113 @@ +## Linker script for GNU ld 2.11.94+ only. +## +## Copyright (C) 2002 Free Software Foundation, Inc. +## +## This file is part of the libstdc++ version 3 distribution. +## +## This file is part of the GNU ISO C++ Library. This library is free +## software; you can redistribute it and/or modify it under the +## terms of the GNU General Public License as published by the +## Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This library is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License along +## with this library; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +## USA. + + +GLIBCPP_3.1 { + + global: + + # Names inside the 'extern' block are demangled names. + # All but the last are terminated with a semicolon. + extern "C++" + { + std::[A-Za-z]*; + std::__throw_*; + std::__basic_file*; + std::__num_base*; + std::__timepunct*; + std::__numeric_limits_base*; + std::_S_bit_count; + std::_S_first_one; + std::__default_alloc_template*; + std::__malloc_alloc_template* + }; + + # Names not in an 'extern' block are mangled names. + _ZSt9has_facet*; + + # operator new(unsigned) + _Znwj; + # operator new(unsigned, std::nothrow_t const&) + _ZnwjRKSt9nothrow_t; + # operator new(unsigned long) + _Znwm; + # operator new(unsigned long, std::nothrow_t const&) + _ZnwmRKSt9nothrow_t; + + # operator delete(void*) + _ZdlPv; + # operator delete(void*, std::nothrow_t const&) + _ZdlPvRKSt9nothrow_t; + + # operator new[](unsigned) + _Znaj; + # operator new[](unsigned, std::nothrow_t const&) + _ZnajRKSt9nothrow_t; + # operator new[](unsigned long) + _Znam; + # operator new[](unsigned long, std::nothrow_t const&) + _ZnamRKSt9nothrow_t; + + # operator delete[](void*) + _ZdaPv; + # operator delete[](void*, std::nothrow_t const&) + _ZdaPvRKSt9nothrow_t; + + # vtable + _ZTV*; + _ZTT*; + + # typeinfo + _ZTI*; + _ZTS*; + + # function-scope static objects requires a guard variable. + _ZGV*; + + # virtual function thunks + _ZTh*; + _ZTv*; + _ZTc*; + + # std::__convert_to_v + _ZSt14__convert_to_v*; + + local: + *; +}; + + +# Symbols in the support library (libsupc++) have their own tag. +CXXABI_1 { + + global: + __cxa_*; + __gxx_personality_v0; + __gxx_personality_sj0; + __dynamic_cast; + + # __gnu_cxx::_verbose_terminate_handler() + _ZN9__gnu_cxx27__verbose_terminate_handlerEv; + + local: + *; +}; diff --git a/contrib/libstdc++/config/locale/generic/c_locale.cc b/contrib/libstdc++/config/locale/generic/c_locale.cc new file mode 100644 index 0000000..8ede46e --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/c_locale.cc @@ -0,0 +1,220 @@ +// Wrapper for underlying C-language localization -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.8 Standard locale categories. +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +#ifdef _GLIBCPP_HAVE_IEEEFP_H +#include <ieeefp.h> +#endif + +namespace std +{ + // Specializations for all types used in num_get. + template<> + void + __convert_to_v(const char* __s, long& __v, ios_base::iostate& __err, + const __c_locale&, int __base) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + long __l = strtol(__s, &__sanity, __base); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __l; + else + __err |= ios_base::failbit; + } + } + + template<> + void + __convert_to_v(const char* __s, unsigned long& __v, + ios_base::iostate& __err, const __c_locale&, int __base) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + unsigned long __ul = strtoul(__s, &__sanity, __base); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __ul; + else + __err |= ios_base::failbit; + } + } + +#ifdef _GLIBCPP_USE_LONG_LONG + template<> + void + __convert_to_v(const char* __s, long long& __v, ios_base::iostate& __err, + const __c_locale&, int __base) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + long long __ll = strtoll(__s, &__sanity, __base); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __ll; + else + __err |= ios_base::failbit; + } + } + + template<> + void + __convert_to_v(const char* __s, unsigned long long& __v, + ios_base::iostate& __err, const __c_locale&, int __base) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + unsigned long long __ull = strtoull(__s, &__sanity, __base); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __ull; + else + __err |= ios_base::failbit; + } + } +#endif + + template<> + void + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, + const __c_locale&, int) + { + if (!(__err & ios_base::failbit)) + { + // Assumes __s formatted for "C" locale. + const char* __old = setlocale(LC_ALL, "C"); + char* __sanity; + errno = 0; +#if defined(_GLIBCPP_USE_C99) + float __f = strtof(__s, &__sanity); +#else + double __d = strtod(__s, &__sanity); + float __f = static_cast<float>(__d); +#ifdef _GLIBCPP_HAVE_FINITEF + if (!finitef (__f)) + errno = ERANGE; +#elif defined (_GLIBCPP_HAVE_FINITE) + if (!finite (static_cast<double> (__f))) + errno = ERANGE; +#elif defined (_GLIBCPP_HAVE_ISINF) + if (isinf (static_cast<double> (__f))) + errno = ERANGE; +#else + if (fabs(__d) > numeric_limits<float>::max()) + errno = ERANGE; +#endif +#endif + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __f; + else + __err |= ios_base::failbit; + setlocale(LC_ALL, __old); + } + } + + template<> + void + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, + const __c_locale&, int) + { + if (!(__err & ios_base::failbit)) + { + // Assumes __s formatted for "C" locale. + const char* __old = setlocale(LC_ALL, "C"); + char* __sanity; + errno = 0; + double __d = strtod(__s, &__sanity); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __d; + else + __err |= ios_base::failbit; + setlocale(LC_ALL, __old); + } + } + + template<> + void + __convert_to_v(const char* __s, long double& __v, + ios_base::iostate& __err, const __c_locale&, int) + { + if (!(__err & ios_base::failbit)) + { + // Assumes __s formatted for "C" locale. + const char* __old = setlocale(LC_ALL, "C"); +#if defined(_GLIBCPP_USE_C99) + char* __sanity; + errno = 0; + long double __ld = strtold(__s, &__sanity); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __ld; +#else + typedef char_traits<char>::int_type int_type; + long double __ld; + errno = 0; + int __p = sscanf(__s, "%Lf", &__ld); + if (errno == ERANGE) + __p = 0; +#ifdef _GLIBCPP_HAVE_FINITEL + if ((__p == 1) && !finitel (__ld)) + __p = 0; +#endif + if (__p && static_cast<int_type>(__p) != char_traits<char>::eof()) + __v = __ld; +#endif + else + __err |= ios_base::failbit; + setlocale(LC_ALL, __old); + } + } + + void + locale::facet::_S_create_c_locale(__c_locale& __cloc, const char*, + __c_locale) + { __cloc = NULL; } + + void + locale::facet::_S_destroy_c_locale(__c_locale& __cloc) + { __cloc = NULL; } + + __c_locale + locale::facet::_S_clone_c_locale(__c_locale&) + { return __c_locale(); } +} // namespace std diff --git a/contrib/libstdc++/config/locale/generic/c_locale.h b/contrib/libstdc++/config/locale/generic/c_locale.h new file mode 100644 index 0000000..0fc9a25 --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/c_locale.h @@ -0,0 +1,41 @@ +// Wrapper for underlying C-language localization -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.8 Standard locale categories. +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <clocale> + +namespace std +{ + typedef int* __c_locale; +} diff --git a/contrib/libstdc++/config/locale/generic/codecvt_specializations.h b/contrib/libstdc++/config/locale/generic/codecvt_specializations.h new file mode 100644 index 0000000..24db4c8 --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/codecvt_specializations.h @@ -0,0 +1,38 @@ +// Locale support (codecvt) -*- C++ -*- + +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.1.5 Template class codecvt +// + +// Warning: this file is not meant for user inclusion. Use <locale>. + +// Written by Benjamin Kosnik <bkoz@cygnus.com> + +// XXX dummy file diff --git a/contrib/libstdc++/config/locale/generic/collate_members.cc b/contrib/libstdc++/config/locale/generic/collate_members.cc new file mode 100644 index 0000000..93767d9 --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/collate_members.cc @@ -0,0 +1,72 @@ +// std::collate implementation details, generic version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.4.1.2 collate virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + // These are basically extensions to char_traits, and perhaps should + // be put there instead of here. + template<> + int + collate<char>::_M_compare(const char* __one, const char* __two) const + { + int __cmp = strcoll(__one, __two); + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); + } + + template<> + size_t + collate<char>::_M_transform(char* __to, const char* __from, + size_t __n) const + { return strxfrm(__to, __from, __n); } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + int + collate<wchar_t>::_M_compare(const wchar_t* __one, + const wchar_t* __two) const + { + int __cmp = wcscoll(__one, __two); + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); + } + + template<> + size_t + collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from, + size_t __n) const + { return wcsxfrm(__to, __from, __n); } +#endif +} diff --git a/contrib/libstdc++/config/locale/generic/ctype_members.cc b/contrib/libstdc++/config/locale/generic/ctype_members.cc new file mode 100644 index 0000000..5a66484 --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/ctype_members.cc @@ -0,0 +1,195 @@ +// std::ctype implementation details, generic version -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + // NB: The other ctype<char> specializations are in src/locale.cc and + // various /config/os/* files. + template<> + ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) + : ctype<char>(0, false, __refs) + { + _S_destroy_c_locale(_M_c_locale_ctype); + _S_create_c_locale(_M_c_locale_ctype, __s); + } + +#ifdef _GLIBCPP_USE_WCHAR_T + ctype<wchar_t>::__wmask_type + ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const + { + __wmask_type __ret; + switch (__m) + { + case space: + __ret = wctype("space"); + break; + case print: + __ret = wctype("print"); + break; + case cntrl: + __ret = wctype("cntrl"); + break; + case upper: + __ret = wctype("upper"); + break; + case lower: + __ret = wctype("lower"); + break; + case alpha: + __ret = wctype("alpha"); + break; + case digit: + __ret = wctype("digit"); + break; + case punct: + __ret = wctype("punct"); + break; + case xdigit: + __ret = wctype("xdigit"); + break; + case alnum: + __ret = wctype("alnum"); + break; + case graph: + __ret = wctype("graph"); + break; + default: + __ret = 0; + } + return __ret; + }; + + wchar_t + ctype<wchar_t>::do_toupper(wchar_t __c) const + { return towupper(__c); } + + const wchar_t* + ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const + { + while (__lo < __hi) + { + *__lo = towupper(*__lo); + ++__lo; + } + return __hi; + } + + wchar_t + ctype<wchar_t>::do_tolower(wchar_t __c) const + { return towlower(__c); } + + const wchar_t* + ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const + { + while (__lo < __hi) + { + *__lo = towlower(*__lo); + ++__lo; + } + return __hi; + } + + bool + ctype<wchar_t>:: + do_is(mask __m, char_type __c) const + { return static_cast<bool>(iswctype(__c, _M_convert_to_wmask(__m))); } + + const wchar_t* + ctype<wchar_t>:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __m) const + { + while (__lo < __hi && !this->do_is(*__m, *__lo)) + ++__lo; + return __lo; + } + + const wchar_t* + ctype<wchar_t>:: + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const + { + while (__lo < __hi && !this->do_is(__m, *__lo)) + ++__lo; + return __lo; + } + + const wchar_t* + ctype<wchar_t>:: + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const + { + while (__lo < __hi && this->do_is(__m, *__lo) != 0) + ++__lo; + return __lo; + } + + wchar_t + ctype<wchar_t>:: + do_widen(char __c) const + { return btowc(__c); } + + const char* + ctype<wchar_t>:: + do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const + { + mbstate_t __state; + memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t)); + mbsrtowcs(__dest, &__lo, __hi - __lo, &__state); + return __hi; + } + + char + ctype<wchar_t>:: + do_narrow(wchar_t __wc, char __dfault) const + { + int __c = wctob(__wc); + return (__c == EOF ? __dfault : static_cast<char>(__c)); + } + + const wchar_t* + ctype<wchar_t>:: + do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, + char* __dest) const + { + mbstate_t __state; + memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t)); + size_t __len = __hi - __lo; + size_t __conv = wcsrtombs(__dest, &__lo, __len, &__state); + if (__conv == __len) + *__dest = __dfault; + return __hi; + } +#endif // _GLIBCPP_USE_WCHAR_T +} diff --git a/contrib/libstdc++/config/locale/generic/messages_members.cc b/contrib/libstdc++/config/locale/generic/messages_members.cc new file mode 100644 index 0000000..480ab88 --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/messages_members.cc @@ -0,0 +1,45 @@ +// std::messages implementation details, generic version -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + // Specializations + template<> + string + messages<char>::do_get(catalog, int, int, const string& __dfault) const + { return __dfault; } +} diff --git a/contrib/libstdc++/config/locale/generic/messages_members.h b/contrib/libstdc++/config/locale/generic/messages_members.h new file mode 100644 index 0000000..62dd24d --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/messages_members.h @@ -0,0 +1,58 @@ +// std::messages implementation details, generic version -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + + // Non-virtual member functions. + template<typename _CharT> + typename messages<_CharT>::catalog + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, + const char*) const + { return this->do_open(__s, __loc); } + + // Virtual member functions. + template<typename _CharT> + typename messages<_CharT>::catalog + messages<_CharT>::do_open(const basic_string<char>&, const locale&) const + { return 0; } + + template<typename _CharT> + typename messages<_CharT>::string_type + messages<_CharT>::do_get(catalog, int, int, + const string_type& __dfault) const + { return __dfault; } + + template<typename _CharT> + void + messages<_CharT>::do_close(catalog) const + { } diff --git a/contrib/libstdc++/config/locale/generic/monetary_members.cc b/contrib/libstdc++/config/locale/generic/monetary_members.cc new file mode 100644 index 0000000..7c2e13b --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/monetary_members.cc @@ -0,0 +1,127 @@ +// std::moneypunct implementation details, generic version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + // Construct and return valid pattern consisting of some combination of: + // space none symbol sign value + money_base::pattern + money_base::_S_construct_pattern(char, char, char) + { return _S_default_pattern; } + + template<> + void + moneypunct<char, true>::_M_initialize_moneypunct(__c_locale) + { + // "C" locale + _M_decimal_point = '.'; + _M_thousands_sep = ','; + _M_grouping = ""; + _M_curr_symbol = ""; + _M_positive_sign = ""; + _M_negative_sign = ""; + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } + + template<> + void + moneypunct<char, false>::_M_initialize_moneypunct(__c_locale) + { + // "C" locale + _M_decimal_point = '.'; + _M_thousands_sep = ','; + _M_grouping = ""; + _M_curr_symbol = ""; + _M_positive_sign = ""; + _M_negative_sign = ""; + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } + + template<> + moneypunct<char, true>::~moneypunct() + { } + + template<> + moneypunct<char, false>::~moneypunct() + { } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + void + moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale) + { + // "C" locale + _M_decimal_point = L'.'; + _M_thousands_sep = L','; + _M_grouping = ""; + _M_curr_symbol = L""; + _M_positive_sign = L""; + _M_negative_sign = L""; + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } + + template<> + void + moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale) + { + // "C" locale + _M_decimal_point = L'.'; + _M_thousands_sep = L','; + _M_grouping = ""; + _M_curr_symbol = L""; + _M_positive_sign = L""; + _M_negative_sign = L""; + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } + + template<> + moneypunct<wchar_t, true>::~moneypunct() + { } + + template<> + moneypunct<wchar_t, false>::~moneypunct() + { } +#endif +} diff --git a/contrib/libstdc++/config/locale/generic/numeric_members.cc b/contrib/libstdc++/config/locale/generic/numeric_members.cc new file mode 100644 index 0000000..f942e04 --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/numeric_members.cc @@ -0,0 +1,73 @@ +// std::numpunct implementation details, generic version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + template<> + void + numpunct<char>::_M_initialize_numpunct(__c_locale) + { + // "C" locale + _M_decimal_point = '.'; + _M_thousands_sep = ','; + _M_grouping = ""; + _M_truename = "true"; + _M_falsename = "false"; + } + + template<> + numpunct<char>::~numpunct() + { } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + void + numpunct<wchar_t>::_M_initialize_numpunct(__c_locale) + { + // "C" locale + _M_decimal_point = L'.'; + _M_thousands_sep = L','; + _M_grouping = ""; + _M_truename = L"true"; + _M_falsename = L"false"; + } + + template<> + numpunct<wchar_t>::~numpunct() + { } +#endif +} diff --git a/contrib/libstdc++/config/locale/generic/time_members.cc b/contrib/libstdc++/config/locale/generic/time_members.cc new file mode 100644 index 0000000..16a4998 --- /dev/null +++ b/contrib/libstdc++/config/locale/generic/time_members.cc @@ -0,0 +1,202 @@ +// std::time_get, std::time_put implementation, GNU version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + template<> + __timepunct<char>::~__timepunct() + { + if (_M_c_locale_timepunct != _S_c_locale) + _S_destroy_c_locale(_M_c_locale_timepunct); + } + + template<> + void + __timepunct<char>:: + _M_put(char* __s, size_t __maxlen, const char* __format, + const tm* __tm) const + { + const char* __old = setlocale(LC_ALL, _M_name_timepunct); + strftime(__s, __maxlen, __format, __tm); + setlocale(LC_ALL, __old); + } + + template<> + void + __timepunct<char>::_M_initialize_timepunct(__c_locale) + { + // "C" locale + _M_date_format = "%m/%d/%Y"; + _M_date_era_format = "%m/%d/%Y"; + _M_time_format = "%H:%M:%S"; + _M_time_era_format = "%H:%M:%S"; + _M_date_time_format = ""; + _M_date_time_era_format = ""; + _M_am = "AM"; + _M_pm = "PM"; + _M_am_pm_format = ""; + + // Day names, starting with "C"'s Sunday. + _M_day1 = "Sunday"; + _M_day2 = "Monday"; + _M_day3 = "Tuesday"; + _M_day4 = "Wednesday"; + _M_day5 = "Thursday"; + _M_day6 = "Friday"; + _M_day7 = "Saturday"; + + // Abbreviated day names, starting with "C"'s Sun. + _M_day_a1 = "Sun"; + _M_day_a2 = "Mon"; + _M_day_a3 = "Tue"; + _M_day_a4 = "Wed"; + _M_day_a5 = "Thu"; + _M_day_a6 = "Fri"; + _M_day_a7 = "Sat"; + + // Month names, starting with "C"'s January. + _M_month01 = "January"; + _M_month02 = "February"; + _M_month03 = "March"; + _M_month04 = "April"; + _M_month05 = "May"; + _M_month06 = "June"; + _M_month07 = "July"; + _M_month08 = "August"; + _M_month09 = "September"; + _M_month10 = "October"; + _M_month11 = "November"; + _M_month12 = "December"; + + // Abbreviated month names, starting with "C"'s Jan. + _M_month_a01 = "Jan"; + _M_month_a02 = "Feb"; + _M_month_a03 = "Mar"; + _M_month_a04 = "Apr"; + _M_month_a05 = "May"; + _M_month_a06 = "Jun"; + _M_month_a07 = "July"; + _M_month_a08 = "Aug"; + _M_month_a09 = "Sep"; + _M_month_a10 = "Oct"; + _M_month_a11 = "Nov"; + _M_month_a12 = "Dec"; + } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + __timepunct<wchar_t>::~__timepunct() + { + if (_M_c_locale_timepunct != _S_c_locale) + _S_destroy_c_locale(_M_c_locale_timepunct); + } + + template<> + void + __timepunct<wchar_t>:: + _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, + const tm* __tm) const + { + const char* __old = setlocale(LC_ALL, _M_name_timepunct); + wcsftime(__s, __maxlen, __format, __tm); + setlocale(LC_ALL, __old); + } + + template<> + void + __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale) + { + // "C" locale + _M_date_format = L"%m/%d/%y"; + _M_date_era_format = L"%m/%d/%y"; + _M_time_format = L"%H:%M:%S"; + _M_time_era_format = L"%H:%M:%S"; + _M_date_time_format = L""; + _M_date_time_era_format = L""; + _M_am = L"AM"; + _M_pm = L"PM"; + _M_am_pm_format = L""; + + // Day names, starting with "C"'s Sunday. + _M_day1 = L"Sunday"; + _M_day2 = L"Monday"; + _M_day3 = L"Tuesday"; + _M_day4 = L"Wednesday"; + _M_day5 = L"Thursday"; + _M_day6 = L"Friday"; + _M_day7 = L"Saturday"; + + // Abbreviated day names, starting with "C"'s Sun. + _M_day_a1 = L"Sun"; + _M_day_a2 = L"Mon"; + _M_day_a3 = L"Tue"; + _M_day_a4 = L"Wed"; + _M_day_a5 = L"Thu"; + _M_day_a6 = L"Fri"; + _M_day_a7 = L"Sat"; + + // Month names, starting with "C"'s January. + _M_month01 = L"January"; + _M_month02 = L"February"; + _M_month03 = L"March"; + _M_month04 = L"April"; + _M_month05 = L"May"; + _M_month06 = L"June"; + _M_month07 = L"July"; + _M_month08 = L"August"; + _M_month09 = L"September"; + _M_month10 = L"October"; + _M_month11 = L"November"; + _M_month12 = L"December"; + + // Abbreviated month names, starting with "C"'s Jan. + _M_month_a01 = L"Jan"; + _M_month_a02 = L"Feb"; + _M_month_a03 = L"Mar"; + _M_month_a04 = L"Apr"; + _M_month_a05 = L"May"; + _M_month_a06 = L"Jun"; + _M_month_a07 = L"July"; + _M_month_a08 = L"Aug"; + _M_month_a09 = L"Sep"; + _M_month_a10 = L"Oct"; + _M_month_a11 = L"Nov"; + _M_month_a12 = L"Dec"; + } +#endif +} diff --git a/contrib/libstdc++/config/locale/gnu/c_locale.cc b/contrib/libstdc++/config/locale/gnu/c_locale.cc new file mode 100644 index 0000000..60ec54d --- /dev/null +++ b/contrib/libstdc++/config/locale/gnu/c_locale.cc @@ -0,0 +1,185 @@ +// Wrapper for underlying C-language localization -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.8 Standard locale categories. +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> +#include <stdexcept> +#include <langinfo.h> + +namespace std +{ + template<> + void + __convert_to_v(const char* __s, long& __v, ios_base::iostate& __err, + const __c_locale& __cloc, int __base) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + long __l = __strtol_l(__s, &__sanity, __base, __cloc); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __l; + else + __err |= ios_base::failbit; + } + } + + template<> + void + __convert_to_v(const char* __s, unsigned long& __v, + ios_base::iostate& __err, const __c_locale& __cloc, + int __base) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + unsigned long __ul = __strtoul_l(__s, &__sanity, __base, __cloc); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __ul; + else + __err |= ios_base::failbit; + } + } + +#ifdef _GLIBCPP_USE_LONG_LONG + template<> + void + __convert_to_v(const char* __s, long long& __v, ios_base::iostate& __err, + const __c_locale& __cloc, int __base) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + long long __ll = __strtoll_l(__s, &__sanity, __base, __cloc); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __ll; + else + __err |= ios_base::failbit; + } + } + + template<> + void + __convert_to_v(const char* __s, unsigned long long& __v, + ios_base::iostate& __err, const __c_locale& __cloc, + int __base) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + unsigned long long __ull = __strtoull_l(__s, &__sanity, __base, + __cloc); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __ull; + else + __err |= ios_base::failbit; + } + } +#endif + + template<> + void + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, + const __c_locale& __cloc, int) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + float __f = __strtof_l(__s, &__sanity, __cloc); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __f; + else + __err |= ios_base::failbit; + } + } + + template<> + void + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, + const __c_locale& __cloc, int) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + double __d = __strtod_l(__s, &__sanity, __cloc); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __d; + else + __err |= ios_base::failbit; + } + } + + template<> + void + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, + const __c_locale& __cloc, int) + { + if (!(__err & ios_base::failbit)) + { + char* __sanity; + errno = 0; + long double __ld = __strtold_l(__s, &__sanity, __cloc); + if (__sanity != __s && *__sanity == '\0' && errno != ERANGE) + __v = __ld; + else + __err |= ios_base::failbit; + } + } + + void + locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, + __c_locale __old) + { + __cloc = __newlocale(1 << LC_ALL, __s, __old); + if (!__cloc) + { + // This named locale is not supported by the underlying OS. + __throw_runtime_error("attempt to create locale from unknown name"); + } + } + + void + locale::facet::_S_destroy_c_locale(__c_locale& __cloc) + { __freelocale(__cloc); } + + __c_locale + locale::facet::_S_clone_c_locale(__c_locale& __cloc) + { return __duplocale(__cloc); } +} // namespace std diff --git a/contrib/libstdc++/config/locale/gnu/c_locale.h b/contrib/libstdc++/config/locale/gnu/c_locale.h new file mode 100644 index 0000000..3ce1781 --- /dev/null +++ b/contrib/libstdc++/config/locale/gnu/c_locale.h @@ -0,0 +1,46 @@ +// Wrapper for underlying C-language localization -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.8 Standard locale categories. +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <clocale> +#include <langinfo.h> // For codecvt +#include <iconv.h> // For codecvt using iconv, iconv_t +#include <libintl.h> // For messages + +#define _GLIBCPP_C_LOCALE_GNU 1 + +namespace std +{ + typedef __locale_t __c_locale; +} diff --git a/contrib/libstdc++/config/locale/gnu/collate_members.cc b/contrib/libstdc++/config/locale/gnu/collate_members.cc new file mode 100644 index 0000000..3b55f69 --- /dev/null +++ b/contrib/libstdc++/config/locale/gnu/collate_members.cc @@ -0,0 +1,72 @@ +// std::collate implementation details, GNU version -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.4.1.2 collate virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + // These are basically extensions to char_traits, and perhaps should + // be put there instead of here. + template<> + int + collate<char>::_M_compare(const char* __one, const char* __two) const + { + int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); + } + + template<> + size_t + collate<char>::_M_transform(char* __to, const char* __from, + size_t __n) const + { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + int + collate<wchar_t>::_M_compare(const wchar_t* __one, + const wchar_t* __two) const + { + int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); + } + + template<> + size_t + collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from, + size_t __n) const + { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } +#endif +} diff --git a/contrib/libstdc++/config/locale/gnu/ctype_members.cc b/contrib/libstdc++/config/locale/gnu/ctype_members.cc new file mode 100644 index 0000000..090738b --- /dev/null +++ b/contrib/libstdc++/config/locale/gnu/ctype_members.cc @@ -0,0 +1,202 @@ +// std::ctype implementation details, GNU version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + // NB: The other ctype<char> specializations are in src/locale.cc and + // various /config/os/* files. + template<> + ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) + : ctype<char>(0, false, __refs) + { + if (_M_c_locale_ctype != _S_c_locale) + _S_destroy_c_locale(_M_c_locale_ctype); + _S_create_c_locale(_M_c_locale_ctype, __s); + _M_toupper = _M_c_locale_ctype->__ctype_toupper; + _M_tolower = _M_c_locale_ctype->__ctype_tolower; + _M_table = _M_c_locale_ctype->__ctype_b; + } + +#ifdef _GLIBCPP_USE_WCHAR_T + ctype<wchar_t>::__wmask_type + ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const + { + __wmask_type __ret; + switch (__m) + { + case space: + __ret = __wctype_l("space", _M_c_locale_ctype); + break; + case print: + __ret = __wctype_l("print", _M_c_locale_ctype); + break; + case cntrl: + __ret = __wctype_l("cntrl", _M_c_locale_ctype); + break; + case upper: + __ret = __wctype_l("upper", _M_c_locale_ctype); + break; + case lower: + __ret = __wctype_l("lower", _M_c_locale_ctype); + break; + case alpha: + __ret = __wctype_l("alpha", _M_c_locale_ctype); + break; + case digit: + __ret = __wctype_l("digit", _M_c_locale_ctype); + break; + case punct: + __ret = __wctype_l("punct", _M_c_locale_ctype); + break; + case xdigit: + __ret = __wctype_l("xdigit", _M_c_locale_ctype); + break; + case alnum: + __ret = __wctype_l("alnum", _M_c_locale_ctype); + break; + case graph: + __ret = __wctype_l("graph", _M_c_locale_ctype); + break; + default: + __ret = 0; + } + return __ret; + }; + + wchar_t + ctype<wchar_t>::do_toupper(wchar_t __c) const + { return __towupper_l(__c, _M_c_locale_ctype); } + + const wchar_t* + ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const + { + while (__lo < __hi) + { + *__lo = __towupper_l(*__lo, _M_c_locale_ctype); + ++__lo; + } + return __hi; + } + + wchar_t + ctype<wchar_t>::do_tolower(wchar_t __c) const + { return __towlower_l(__c, _M_c_locale_ctype); } + + const wchar_t* + ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const + { + while (__lo < __hi) + { + *__lo = __towlower_l(*__lo, _M_c_locale_ctype); + ++__lo; + } + return __hi; + } + + bool + ctype<wchar_t>:: + do_is(mask __m, char_type __c) const + { + return static_cast<bool>(__iswctype_l(__c, _M_convert_to_wmask(__m), + _M_c_locale_ctype)); + } + + const wchar_t* + ctype<wchar_t>:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __m) const + { + while (__lo < __hi && !this->do_is(*__m, *__lo)) + ++__lo; + return __lo; + } + + const wchar_t* + ctype<wchar_t>:: + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const + { + while (__lo < __hi && !this->do_is(__m, *__lo)) + ++__lo; + return __lo; + } + + const wchar_t* + ctype<wchar_t>:: + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const + { + while (__lo < __hi && this->do_is(__m, *__lo) != 0) + ++__lo; + return __lo; + } + + wchar_t + ctype<wchar_t>:: + do_widen(char __c) const + { return btowc(__c); } + + const char* + ctype<wchar_t>:: + do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const + { + mbstate_t __state; + memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t)); + mbsrtowcs(__dest, &__lo, __hi - __lo, &__state); + return __hi; + } + + char + ctype<wchar_t>:: + do_narrow(wchar_t __wc, char __dfault) const + { + int __c = wctob(__wc); + return (__c == EOF ? __dfault : static_cast<char>(__c)); + } + + const wchar_t* + ctype<wchar_t>:: + do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, + char* __dest) const + { + mbstate_t __state; + memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t)); + size_t __len = __hi - __lo; + size_t __conv = wcsrtombs(__dest, &__lo, __len, &__state); + if (__conv == __len) + *__dest = __dfault; + return __hi; + } +#endif // _GLIBCPP_USE_WCHAR_T +} diff --git a/contrib/libstdc++/config/locale/gnu/messages_members.cc b/contrib/libstdc++/config/locale/gnu/messages_members.cc new file mode 100644 index 0000000..f202003 --- /dev/null +++ b/contrib/libstdc++/config/locale/gnu/messages_members.cc @@ -0,0 +1,57 @@ +// std::messages implementation details, GNU version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + // Specializations. + template<> + string + messages<char>::do_get(catalog, int, int, const string& __dfault) const + { +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __c_locale __old = __uselocale(_M_c_locale_messages); + const char* __msg = const_cast<const char*>(gettext(__dfault.c_str())); + __uselocale(__old); + return string(__msg); +#else + const char* __old = setlocale(LC_ALL, _M_name_messages); + const char* __msg = gettext(__dfault.c_str()); + setlocale(LC_ALL, __old); + return string(__msg); +#endif + } +} diff --git a/contrib/libstdc++/config/locale/gnu/messages_members.h b/contrib/libstdc++/config/locale/gnu/messages_members.h new file mode 100644 index 0000000..d664d39 --- /dev/null +++ b/contrib/libstdc++/config/locale/gnu/messages_members.h @@ -0,0 +1,78 @@ +// std::messages implementation details, GNU version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + + // Non-virtual member functions. + template<typename _CharT> + typename messages<_CharT>::catalog + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, + const char* __dir) const + { + bindtextdomain(__s.c_str(), __dir); + return this->do_open(__s, __loc); + } + + template<typename _CharT> + typename messages<_CharT>::catalog + messages<_CharT>::do_open(const basic_string<char>& __s, + const locale&) const + { + // No error checking is done, assume the catalog exists and can + // be used. + textdomain(__s.c_str()); + return 0; + } + + template<typename _CharT> + typename messages<_CharT>::string_type + messages<_CharT>::do_get(catalog, int, int, + const string_type& __dfault) const + { +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __c_locale __old = __uselocale(_M_c_locale_messages); + char* __msg = gettext(_M_convert_to_char(__dfault)); + __uselocale(__old); + return _M_convert_from_char(__msg); +#else + const char* __old = setlocale(LC_ALL, _M_name_messages); + char* __msg = gettext(_M_convert_to_char(__dfault)); + setlocale(LC_ALL, __old); + return _M_convert_from_char(__msg); +#endif + } + + template<typename _CharT> + void + messages<_CharT>::do_close(catalog) const + { } diff --git a/contrib/libstdc++/config/locale/gnu/monetary_members.cc b/contrib/libstdc++/config/locale/gnu/monetary_members.cc new file mode 100644 index 0000000..bf9b50c --- /dev/null +++ b/contrib/libstdc++/config/locale/gnu/monetary_members.cc @@ -0,0 +1,501 @@ +// std::moneypunct implementation details, GNU version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + // Construct and return valid pattern consisting of some combination of: + // space none symbol sign value + money_base::pattern + money_base::_S_construct_pattern(char __precedes, char __space, char __posn) + { + pattern __ret; + + // This insanely complicated routine attempts to construct a valid + // pattern for use with monyepunct. A couple of invariants: + + // if (__precedes) symbol -> value + // else value -> symbol + + // if (__space) space + // else none + + // none == never first + // space never first or last + + // Any elegant implementations of this are welcome. + switch (__posn) + { + case 0: + case 1: + // 1 The sign precedes the value and symbol. + if (__space) + { + // Pattern starts with sign. + if (__precedes) + { + __ret.field[1] = symbol; + __ret.field[2] = space; + __ret.field[3] = value; + } + else + { + __ret.field[1] = value; + __ret.field[2] = space; + __ret.field[3] = symbol; + } + __ret.field[0] = sign; + } + else + { + // Pattern starts with sign and ends with none. + if (__precedes) + { + __ret.field[1] = symbol; + __ret.field[2] = value; + } + else + { + __ret.field[1] = value; + __ret.field[2] = symbol; + } + __ret.field[0] = sign; + __ret.field[3] = none; + } + break; + case 2: + // 2 The sign follows the value and symbol. + if (__space) + { + // Pattern either ends with sign. + if (__precedes) + { + __ret.field[0] = symbol; + __ret.field[1] = space; + __ret.field[2] = value; + } + else + { + __ret.field[0] = value; + __ret.field[1] = space; + __ret.field[2] = symbol; + } + __ret.field[3] = sign; + } + else + { + // Pattern ends with sign then none. + if (__precedes) + { + __ret.field[0] = symbol; + __ret.field[1] = value; + } + else + { + __ret.field[0] = value; + __ret.field[1] = symbol; + } + __ret.field[2] = sign; + __ret.field[3] = none; + } + break; + case 3: + // 3 The sign immediately precedes the symbol. + if (__space) + { + // Have space. + if (__precedes) + { + __ret.field[0] = sign; + __ret.field[1] = symbol; + __ret.field[2] = space; + __ret.field[3] = value; + } + else + { + __ret.field[0] = value; + __ret.field[1] = space; + __ret.field[2] = sign; + __ret.field[3] = symbol; + } + } + else + { + // Have none. + if (__precedes) + { + __ret.field[0] = sign; + __ret.field[1] = symbol; + __ret.field[2] = value; + } + else + { + __ret.field[0] = value; + __ret.field[1] = sign; + __ret.field[2] = symbol; + } + __ret.field[3] = none; + } + break; + case 4: + // 4 The sign immediately follows the symbol. + if (__space) + { + // Have space. + if (__precedes) + { + __ret.field[0] = symbol; + __ret.field[1] = sign; + __ret.field[2] = space; + __ret.field[3] = value; + } + else + { + __ret.field[0] = value; + __ret.field[1] = space; + __ret.field[2] = symbol; + __ret.field[3] = sign; + } + } + else + { + // Have none. + if (__precedes) + { + __ret.field[0] = symbol; + __ret.field[1] = sign; + __ret.field[2] = value; + } + else + { + __ret.field[0] = value; + __ret.field[1] = symbol; + __ret.field[2] = sign; + } + __ret.field[3] = none; + } + break; + default: + ; + } + return __ret; + } + + template<> + void + moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc) + { + if (__cloc == _S_c_locale) + { + // "C" locale + _M_decimal_point = '.'; + _M_thousands_sep = ','; + _M_grouping = ""; + _M_curr_symbol = ""; + _M_positive_sign = ""; + _M_negative_sign = ""; + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } + else + { + // Named locale. + _M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc)); + _M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc)); + _M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); + _M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); + + char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); + if (!__nposn) + _M_negative_sign = "()"; + else + _M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); + + // _Intl == true + _M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); + _M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc)); + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); + _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); + _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); + } + } + + template<> + void + moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc) + { + if (__cloc == _S_c_locale) + { + // "C" locale + _M_decimal_point = '.'; + _M_thousands_sep = ','; + _M_grouping = ""; + _M_curr_symbol = ""; + _M_positive_sign = ""; + _M_negative_sign = ""; + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } + else + { + // Named locale. + _M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc)); + _M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc)); + _M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); + _M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); + + char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); + if (!__nposn) + _M_negative_sign = "()"; + else + _M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); + + // _Intl == false + _M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); + _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); + _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); + _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); + } + } + + template<> + moneypunct<char, true>::~moneypunct() + { } + + template<> + moneypunct<char, false>::~moneypunct() + { } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + void + moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc) + { + if (__cloc == _S_c_locale) + { + // "C" locale + _M_decimal_point = L'.'; + _M_thousands_sep = L','; + _M_grouping = ""; + _M_curr_symbol = L""; + _M_positive_sign = L""; + _M_negative_sign = L""; + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } + else + { + // Named locale. + _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); + + _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); + _M_grouping = __nl_langinfo_l(GROUPING, __cloc); + + mbstate_t __state; + size_t __len; + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); + const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); + + // NB: Should swich to __cloc's ctype info first. + __len = strlen(__cpossign); + if (__len) + { + ++__len; + memset(&__state, 0, sizeof(mbstate_t)); + wchar_t* __wcs = new wchar_t[__len]; + mbsrtowcs(__wcs, &__cpossign, __len, &__state); + _M_positive_sign = __wcs; + } + else + _M_positive_sign = L""; + + char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); + __len = strlen(__cnegsign); + if (!__nposn) + _M_negative_sign = L"()"; + else if (__len) + { + ++__len; + memset(&__state, 0, sizeof(mbstate_t)); + wchar_t* __wcs = new wchar_t[__len]; + mbsrtowcs(__wcs, &__cnegsign, __len, &__state); + _M_negative_sign = __wcs; + } + else + _M_negative_sign = L""; + + // _Intl == true. + __len = strlen(__ccurr); + if (__len) + { + ++__len; + memset(&__state, 0, sizeof(mbstate_t)); + wchar_t* __wcs = new wchar_t[__len]; + mbsrtowcs(__wcs, &__ccurr, __len, &__state); + _M_curr_symbol = __wcs; + } + else + _M_curr_symbol = L""; + + _M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc)); + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); + _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); + _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); + } + } + + template<> + void + moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc) + { + if (__cloc == _S_c_locale) + { + // "C" locale + _M_decimal_point = L'.'; + _M_thousands_sep = L','; + _M_grouping = ""; + _M_curr_symbol = L""; + _M_positive_sign = L""; + _M_negative_sign = L""; + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } + else + { + // Named locale. + _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); + _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); + _M_grouping = __nl_langinfo_l(GROUPING, __cloc); + + mbstate_t __state; + size_t __len; + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); + const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); + + // NB: Should swich to __cloc's ctype info first. + __len = strlen(__cpossign); + if (__len) + { + ++__len; + memset(&__state, 0, sizeof(mbstate_t)); + wchar_t* __wcs = new wchar_t[__len]; + mbsrtowcs(__wcs, &__cpossign, __len, &__state); + _M_positive_sign = __wcs; + } + else + _M_positive_sign = L""; + + char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); + __len = strlen(__cnegsign); + if (!__nposn) + _M_negative_sign = L"()"; + else if (__len) + { + ++__len; + memset(&__state, 0, sizeof(mbstate_t)); + wchar_t* __wcs = new wchar_t[__len]; + mbsrtowcs(__wcs, &__cnegsign, __len, &__state); + _M_negative_sign = __wcs; + } + else + _M_negative_sign = L""; + + // _Intl == true. + __len = strlen(__ccurr); + if (__len) + { + ++__len; + memset(&__state, 0, sizeof(mbstate_t)); + wchar_t* __wcs = new wchar_t[__len]; + mbsrtowcs(__wcs, &__ccurr, __len, &__state); + _M_curr_symbol = __wcs; + } + else + _M_curr_symbol = L""; + + _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); + _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn); + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); + _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn); + } + } + + template<> + moneypunct<wchar_t, true>::~moneypunct() + { + if (wcslen(_M_positive_sign)) + delete [] _M_positive_sign; + if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0)) + delete [] _M_negative_sign; + if (wcslen(_M_curr_symbol)) + delete [] _M_curr_symbol; + } + + template<> + moneypunct<wchar_t, false>::~moneypunct() + { + if (wcslen(_M_positive_sign)) + delete [] _M_positive_sign; + if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0)) + delete [] _M_negative_sign; + if (wcslen(_M_curr_symbol)) + delete [] _M_curr_symbol; + } +#endif +} diff --git a/contrib/libstdc++/config/locale/gnu/numeric_members.cc b/contrib/libstdc++/config/locale/gnu/numeric_members.cc new file mode 100644 index 0000000..4806435 --- /dev/null +++ b/contrib/libstdc++/config/locale/gnu/numeric_members.cc @@ -0,0 +1,106 @@ +// std::numpunct implementation details, GNU version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + template<> + void + numpunct<char>::_M_initialize_numpunct(__c_locale __cloc) + { + if (__cloc == _S_c_locale) + { + // "C" locale + _M_decimal_point = '.'; + _M_thousands_sep = ','; + _M_grouping = ""; + } + else + { + // Named locale. + _M_decimal_point = *(__nl_langinfo_l(RADIXCHAR, __cloc)); + _M_thousands_sep = *(__nl_langinfo_l(THOUSEP, __cloc)); + // Check for NUL, which implies no grouping. + if (_M_thousands_sep == '\0') + _M_grouping = ""; + else + _M_grouping = __nl_langinfo_l(GROUPING, __cloc); + } + // NB: There is no way to extact this info from posix locales. + // _M_truename = __nl_langinfo_l(YESSTR, __cloc); + _M_truename = "true"; + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); + _M_falsename = "false"; + } + + template<> + numpunct<char>::~numpunct() + { } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + void + numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc) + { + if (__cloc == _S_c_locale) + { + // "C" locale + _M_decimal_point = L'.'; + _M_thousands_sep = L','; + _M_grouping = ""; + } + else + { + // Named locale. + _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w); + _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w); + if (_M_thousands_sep == L'\0') + _M_grouping = ""; + else + _M_grouping = __nl_langinfo_l(GROUPING, __cloc); + } + // NB: There is no way to extact this info from posix locales. + // _M_truename = __nl_langinfo_l(YESSTR, __cloc); + _M_truename = L"true"; + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); + _M_falsename = L"false"; + } + + template<> + numpunct<wchar_t>::~numpunct() + { } + #endif +} diff --git a/contrib/libstdc++/config/locale/gnu/time_members.cc b/contrib/libstdc++/config/locale/gnu/time_members.cc new file mode 100644 index 0000000..665ea02 --- /dev/null +++ b/contrib/libstdc++/config/locale/gnu/time_members.cc @@ -0,0 +1,336 @@ +// std::time_get, std::time_put implementation, GNU version -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + template<> + __timepunct<char>::~__timepunct() + { + if (_M_c_locale_timepunct != _S_c_locale) + _S_destroy_c_locale(_M_c_locale_timepunct); + } + + template<> + void + __timepunct<char>:: + _M_put(char* __s, size_t __maxlen, const char* __format, + const tm* __tm) const + { +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __strftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm); +#else + const char* __old = setlocale(LC_ALL, _M_name_timepunct); + strftime(__s, __maxlen, __format, __tm); + setlocale(LC_ALL, __old); +#endif + } + + template<> + void + __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc) + { + if (__cloc == _S_c_locale) + { + // "C" locale + _M_date_format = "%m/%d/%y"; + _M_date_era_format = "%m/%d/%y"; + _M_time_format = "%H:%M:%S"; + _M_time_era_format = "%H:%M:%S"; + _M_date_time_format = ""; + _M_date_time_era_format = ""; + _M_am = "AM"; + _M_pm = "PM"; + _M_am_pm_format = ""; + + // Day names, starting with "C"'s Sunday. + _M_day1 = "Sunday"; + _M_day2 = "Monday"; + _M_day3 = "Tuesday"; + _M_day4 = "Wednesday"; + _M_day5 = "Thursday"; + _M_day6 = "Friday"; + _M_day7 = "Saturday"; + + // Abbreviated day names, starting with "C"'s Sun. + _M_day_a1 = "Sun"; + _M_day_a2 = "Mon"; + _M_day_a3 = "Tue"; + _M_day_a4 = "Wed"; + _M_day_a5 = "Thu"; + _M_day_a6 = "Fri"; + _M_day_a7 = "Sat"; + + // Month names, starting with "C"'s January. + _M_month01 = "January"; + _M_month02 = "February"; + _M_month03 = "March"; + _M_month04 = "April"; + _M_month05 = "May"; + _M_month06 = "June"; + _M_month07 = "July"; + _M_month08 = "August"; + _M_month09 = "September"; + _M_month10 = "October"; + _M_month11 = "November"; + _M_month12 = "December"; + + // Abbreviated month names, starting with "C"'s Jan. + _M_month_a01 = "Jan"; + _M_month_a02 = "Feb"; + _M_month_a03 = "Mar"; + _M_month_a04 = "Apr"; + _M_month_a05 = "May"; + _M_month_a06 = "Jun"; + _M_month_a07 = "July"; + _M_month_a08 = "Aug"; + _M_month_a09 = "Sep"; + _M_month_a10 = "Oct"; + _M_month_a11 = "Nov"; + _M_month_a12 = "Dec"; + } + else + { + _M_c_locale_timepunct = _S_clone_c_locale(__cloc); + + _M_date_format = __nl_langinfo_l(D_FMT, __cloc); + _M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); + _M_time_format = __nl_langinfo_l(T_FMT, __cloc); + _M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); + _M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); + _M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, __cloc); + _M_am = __nl_langinfo_l(AM_STR, __cloc); + _M_pm = __nl_langinfo_l(PM_STR, __cloc); + _M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); + + // Day names, starting with "C"'s Sunday. + _M_day1 = __nl_langinfo_l(DAY_1, __cloc); + _M_day2 = __nl_langinfo_l(DAY_2, __cloc); + _M_day3 = __nl_langinfo_l(DAY_3, __cloc); + _M_day4 = __nl_langinfo_l(DAY_4, __cloc); + _M_day5 = __nl_langinfo_l(DAY_5, __cloc); + _M_day6 = __nl_langinfo_l(DAY_6, __cloc); + _M_day7 = __nl_langinfo_l(DAY_7, __cloc); + + // Abbreviated day names, starting with "C"'s Sun. + _M_day_a1 = __nl_langinfo_l(ABDAY_1, __cloc); + _M_day_a2 = __nl_langinfo_l(ABDAY_2, __cloc); + _M_day_a3 = __nl_langinfo_l(ABDAY_3, __cloc); + _M_day_a4 = __nl_langinfo_l(ABDAY_4, __cloc); + _M_day_a5 = __nl_langinfo_l(ABDAY_5, __cloc); + _M_day_a6 = __nl_langinfo_l(ABDAY_6, __cloc); + _M_day_a7 = __nl_langinfo_l(ABDAY_7, __cloc); + + // Month names, starting with "C"'s January. + _M_month01 = __nl_langinfo_l(MON_1, __cloc); + _M_month02 = __nl_langinfo_l(MON_2, __cloc); + _M_month03 = __nl_langinfo_l(MON_3, __cloc); + _M_month04 = __nl_langinfo_l(MON_4, __cloc); + _M_month05 = __nl_langinfo_l(MON_5, __cloc); + _M_month06 = __nl_langinfo_l(MON_6, __cloc); + _M_month07 = __nl_langinfo_l(MON_7, __cloc); + _M_month08 = __nl_langinfo_l(MON_8, __cloc); + _M_month09 = __nl_langinfo_l(MON_9, __cloc); + _M_month10 = __nl_langinfo_l(MON_10, __cloc); + _M_month11 = __nl_langinfo_l(MON_11, __cloc); + _M_month12 = __nl_langinfo_l(MON_12, __cloc); + + // Abbreviated month names, starting with "C"'s Jan. + _M_month_a01 = __nl_langinfo_l(ABMON_1, __cloc); + _M_month_a02 = __nl_langinfo_l(ABMON_2, __cloc); + _M_month_a03 = __nl_langinfo_l(ABMON_3, __cloc); + _M_month_a04 = __nl_langinfo_l(ABMON_4, __cloc); + _M_month_a05 = __nl_langinfo_l(ABMON_5, __cloc); + _M_month_a06 = __nl_langinfo_l(ABMON_6, __cloc); + _M_month_a07 = __nl_langinfo_l(ABMON_7, __cloc); + _M_month_a08 = __nl_langinfo_l(ABMON_8, __cloc); + _M_month_a09 = __nl_langinfo_l(ABMON_9, __cloc); + _M_month_a10 = __nl_langinfo_l(ABMON_10, __cloc); + _M_month_a11 = __nl_langinfo_l(ABMON_11, __cloc); + _M_month_a12 = __nl_langinfo_l(ABMON_12, __cloc); + } + } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + __timepunct<wchar_t>::~__timepunct() + { + if (_M_c_locale_timepunct != _S_c_locale) + _S_destroy_c_locale(_M_c_locale_timepunct); + } + + template<> + void + __timepunct<wchar_t>:: + _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, + const tm* __tm) const + { +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __wcsftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm); +#else + const char* __old = setlocale(LC_ALL, _M_name_timepunct); + wcsftime(__s, __maxlen, __format, __tm); + setlocale(LC_ALL, __old); +#endif + } + + template<> + void + __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc) + { + if (__cloc == _S_c_locale) + { + // "C" locale + _M_date_format = L"%m/%d/%y"; + _M_date_era_format = L"%m/%d/%y"; + _M_time_format = L"%H:%M:%S"; + _M_time_era_format = L"%H:%M:%S"; + _M_date_time_format = L""; + _M_date_time_era_format = L""; + _M_am = L"AM"; + _M_pm = L"PM"; + _M_am_pm_format = L""; + + // Day names, starting with "C"'s Sunday. + _M_day1 = L"Sunday"; + _M_day2 = L"Monday"; + _M_day3 = L"Tuesday"; + _M_day4 = L"Wednesday"; + _M_day5 = L"Thursday"; + _M_day6 = L"Friday"; + _M_day7 = L"Saturday"; + + // Abbreviated day names, starting with "C"'s Sun. + _M_day_a1 = L"Sun"; + _M_day_a2 = L"Mon"; + _M_day_a3 = L"Tue"; + _M_day_a4 = L"Wed"; + _M_day_a5 = L"Thu"; + _M_day_a6 = L"Fri"; + _M_day_a7 = L"Sat"; + + // Month names, starting with "C"'s January. + _M_month01 = L"January"; + _M_month02 = L"February"; + _M_month03 = L"March"; + _M_month04 = L"April"; + _M_month05 = L"May"; + _M_month06 = L"June"; + _M_month07 = L"July"; + _M_month08 = L"August"; + _M_month09 = L"September"; + _M_month10 = L"October"; + _M_month11 = L"November"; + _M_month12 = L"December"; + + // Abbreviated month names, starting with "C"'s Jan. + _M_month_a01 = L"Jan"; + _M_month_a02 = L"Feb"; + _M_month_a03 = L"Mar"; + _M_month_a04 = L"Apr"; + _M_month_a05 = L"May"; + _M_month_a06 = L"Jun"; + _M_month_a07 = L"July"; + _M_month_a08 = L"Aug"; + _M_month_a09 = L"Sep"; + _M_month_a10 = L"Oct"; + _M_month_a11 = L"Nov"; + _M_month_a12 = L"Dec"; + } + else + { + _M_c_locale_timepunct = _S_clone_c_locale(__cloc); + + _M_date_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_FMT, __cloc)); + _M_date_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc)); + _M_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT, __cloc)); + _M_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc)); + _M_date_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_T_FMT, __cloc)); + _M_date_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc)); + _M_am = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WAM_STR, __cloc)); + _M_pm = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WPM_STR, __cloc)); + _M_am_pm_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc)); + + // Day names, starting with "C"'s Sunday. + _M_day1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_1, __cloc)); + _M_day2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_2, __cloc)); + _M_day3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_3, __cloc)); + _M_day4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_4, __cloc)); + _M_day5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_5, __cloc)); + _M_day6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_6, __cloc)); + _M_day7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_7, __cloc)); + + // Abbreviated day names, starting with "C"'s Sun. + _M_day_a1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_1, __cloc)); + _M_day_a2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_2, __cloc)); + _M_day_a3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_3, __cloc)); + _M_day_a4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_4, __cloc)); + _M_day_a5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_5, __cloc)); + _M_day_a6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_6, __cloc)); + _M_day_a7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_7, __cloc)); + + // Month names, starting with "C"'s January. + _M_month01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_1, __cloc)); + _M_month02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_2, __cloc)); + _M_month03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_3, __cloc)); + _M_month04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_4, __cloc)); + _M_month05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_5, __cloc)); + _M_month06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_6, __cloc)); + _M_month07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_7, __cloc)); + _M_month08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_8, __cloc)); + _M_month09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_9, __cloc)); + _M_month10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_10, __cloc)); + _M_month11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_11, __cloc)); + _M_month12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_12, __cloc)); + + // Abbreviated month names, starting with "C"'s Jan. + _M_month_a01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_1, __cloc)); + _M_month_a02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_2, __cloc)); + _M_month_a03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_3, __cloc)); + _M_month_a04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_4, __cloc)); + _M_month_a05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_5, __cloc)); + _M_month_a06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_6, __cloc)); + _M_month_a07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_7, __cloc)); + _M_month_a08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_8, __cloc)); + _M_month_a09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_9, __cloc)); + _M_month_a10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_10, __cloc)); + _M_month_a11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_11, __cloc)); + _M_month_a12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_12, __cloc)); + } + } +#endif +} diff --git a/contrib/libstdc++/config/locale/ieee_1003.1-2001/c_locale.cc b/contrib/libstdc++/config/locale/ieee_1003.1-2001/c_locale.cc new file mode 100644 index 0000000..0a89aee --- /dev/null +++ b/contrib/libstdc++/config/locale/ieee_1003.1-2001/c_locale.cc @@ -0,0 +1,112 @@ +// Wrapper for underlying C-language localization -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.8 Standard locale categories. +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + void + locale::facet::_S_create_c_locale(__c_locale&, const char*, __c_locale*) + { } + + void + locale::facet::_S_destroy_c_locale(__c_locale&) + { } + + __c_locale + locale::facet::_S_clone_c_locale(__c_locale&) + { return __c_locale(); } + + template<> + void + numpunct<char>::_M_initialize_numpunct(__c_locale) + { + // "C" locale + _M_decimal_point = '.'; + _M_thousands_sep = ','; + _M_grouping = ""; + _M_truename = "true"; + _M_falsename = "false"; + } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + void + numpunct<wchar_t>::_M_initialize_numpunct(__c_locale) + { + // "C" locale + _M_decimal_point = L'.'; + _M_thousands_sep = L','; + _M_grouping = ""; + _M_truename = L"true"; + _M_falsename = L"false"; + } +#endif + + template<> + void + moneypunct<char>::_M_initialize_moneypunct(__c_locale) + { + // "C" locale + _M_decimal_point = '.'; + _M_thousands_sep = ','; + _M_grouping = ""; + _M_curr_symbol = string_type(); + _M_positive_sign = string_type(); + _M_negative_sign = string_type(); + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } + +#ifdef _GLIBCPP_USE_WCHAR_T + template<> + void + moneypunct<wchar_t>::_M_initialize_moneypunct(__c_locale) + { + // "C" locale + _M_decimal_point = L'.'; + _M_thousands_sep = L','; + _M_grouping = ""; + _M_curr_symbol = string_type(); + _M_positive_sign = string_type(); + _M_negative_sign = string_type(); + _M_frac_digits = 0; + _M_pos_format = money_base::_S_default_pattern; + _M_neg_format = money_base::_S_default_pattern; + } +#endif +} // namespace std + diff --git a/contrib/libstdc++/config/locale/ieee_1003.1-2001/c_locale.h b/contrib/libstdc++/config/locale/ieee_1003.1-2001/c_locale.h new file mode 100644 index 0000000..4c68f27 --- /dev/null +++ b/contrib/libstdc++/config/locale/ieee_1003.1-2001/c_locale.h @@ -0,0 +1,44 @@ +// Wrapper for underlying C-language localization -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.8 Standard locale categories. +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <clocale> +#include <langinfo.h> // For codecvt +#include <iconv.h> // For codecvt using iconv, iconv_t +#include <nl_types.h> // For messages + +namespace std +{ + typedef int* __c_locale; +} diff --git a/contrib/libstdc++/config/locale/ieee_1003.1-2001/codecvt_specializations.h b/contrib/libstdc++/config/locale/ieee_1003.1-2001/codecvt_specializations.h new file mode 100644 index 0000000..139e6c9 --- /dev/null +++ b/contrib/libstdc++/config/locale/ieee_1003.1-2001/codecvt_specializations.h @@ -0,0 +1,460 @@ +// Locale support (codecvt) -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.1.5 Template class codecvt +// + +// Warning: this file is not meant for user inclusion. Use <locale>. + +// Written by Benjamin Kosnik <bkoz@cygnus.com> + + // XXX + // Define this here to codecvt.cc can have _S_max_size definition. +#define _GLIBCPP_USE___ENC_TRAITS 1 + + // Extension to use icov for dealing with character encodings, + // including conversions and comparisons between various character + // sets. This object encapsulates data that may need to be shared between + // char_traits, codecvt and ctype. + class __enc_traits + { + public: + // Types: + // NB: A conversion descriptor subsumes and enhances the + // functionality of a simple state type such as mbstate_t. + typedef iconv_t __desc_type; + + protected: + // Data Members: + // Max size of charset encoding name + static const int _S_max_size = 32; + // Name of internal character set encoding. + char _M_int_enc[_S_max_size]; + // Name of external character set encoding. + char _M_ext_enc[_S_max_size]; + + // Conversion descriptor between external encoding to internal encoding. + __desc_type _M_in_desc; + // Conversion descriptor between internal encoding to external encoding. + __desc_type _M_out_desc; + + // Details the byte-order marker for the external encoding, if necessary. + int _M_ext_bom; + + // Details the byte-order marker for the internal encoding, if necessary. + int _M_int_bom; + + public: + explicit __enc_traits() + : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0) + { + memset(_M_int_enc, 0, _S_max_size); + memset(_M_ext_enc, 0, _S_max_size); + } + + explicit __enc_traits(const char* __int, const char* __ext, + int __ibom = 0, int __ebom = 0) + : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0) + { + strncpy(_M_int_enc, __int, _S_max_size); + strncpy(_M_ext_enc, __ext, _S_max_size); + } + + // 21.1.2 traits typedefs + // p4 + // typedef STATE_T state_type + // requires: state_type shall meet the requirements of + // CopyConstructible types (20.1.3) + __enc_traits(const __enc_traits& __obj): _M_in_desc(0), _M_out_desc(0) + { + strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size); + strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size); + _M_ext_bom = __obj._M_ext_bom; + _M_int_bom = __obj._M_int_bom; + } + + // Need assignment operator as well. + __enc_traits& + operator=(const __enc_traits& __obj) + { + strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size); + strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size); + _M_in_desc = 0; + _M_out_desc = 0; + _M_ext_bom = __obj._M_ext_bom; + _M_int_bom = __obj._M_int_bom; + } + + ~__enc_traits() + { + __desc_type __err = reinterpret_cast<iconv_t>(-1); + if (_M_in_desc && _M_in_desc != __err) + iconv_close(_M_in_desc); + if (_M_out_desc && _M_out_desc != __err) + iconv_close(_M_out_desc); + } + + void + _M_init() + { + const __desc_type __err = reinterpret_cast<iconv_t>(-1); + if (!_M_in_desc) + { + _M_in_desc = iconv_open(_M_int_enc, _M_ext_enc); + if (_M_in_desc == __err) + __throw_runtime_error("creating iconv input descriptor failed."); + } + if (!_M_out_desc) + { + _M_out_desc = iconv_open(_M_ext_enc, _M_int_enc); + if (_M_out_desc == __err) + __throw_runtime_error("creating iconv output descriptor failed."); + } + } + + bool + _M_good() + { + const __desc_type __err = reinterpret_cast<iconv_t>(-1); + bool __test = _M_in_desc && _M_in_desc != __err; + __test &= _M_out_desc && _M_out_desc != __err; + return __test; + } + + const __desc_type* + _M_get_in_descriptor() + { return &_M_in_desc; } + + const __desc_type* + _M_get_out_descriptor() + { return &_M_out_desc; } + + int + _M_get_external_bom() + { return _M_ext_bom; } + + int + _M_get_internal_bom() + { return _M_int_bom; } + + const char* + _M_get_internal_enc() + { return _M_int_enc; } + + const char* + _M_get_external_enc() + { return _M_ext_enc; } + }; + + // Partial specialization + // This specialization takes advantage of iconv to provide code + // conversions between a large number of character encodings. + template<typename _InternT, typename _ExternT> + class codecvt<_InternT, _ExternT, __enc_traits> + : public __codecvt_abstract_base<_InternT, _ExternT, __enc_traits> + { + public: + // Types: + typedef codecvt_base::result result; + typedef _InternT intern_type; + typedef _ExternT extern_type; + typedef __enc_traits state_type; + typedef __enc_traits::__desc_type __desc_type; + typedef __enc_traits __enc_type; + + // Data Members: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs) + { } + + explicit + codecvt(__enc_type* __enc, size_t __refs = 0) + : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs) + { } + + protected: + virtual + ~codecvt() { } + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual int + do_encoding() const throw(); + + virtual bool + do_always_noconv() const throw(); + + virtual int + do_length(const state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + + template<typename _InternT, typename _ExternT> + locale::id + codecvt<_InternT, _ExternT, __enc_traits>::id; + + // This adaptor works around the signature problems of the second + // argument to iconv(): SUSv2 and others use 'const char**', but glibc 2.2 + // uses 'char**', which matches the POSIX 1003.1-2001 standard. + // Using this adaptor, g++ will do the work for us. + template<typename _T> + inline size_t + __iconv_adaptor(size_t(*__func)(iconv_t, _T, size_t*, char**, size_t*), + iconv_t __cd, char** __inbuf, size_t* __inbytes, + char** __outbuf, size_t* __outbytes) + { return __func(__cd, (_T)__inbuf, __inbytes, __outbuf, __outbytes); } + + template<typename _InternT, typename _ExternT> + codecvt_base::result + codecvt<_InternT, _ExternT, __enc_traits>:: + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const + { + result __ret = error; + if (__state._M_good()) + { + typedef state_type::__desc_type __desc_type; + const __desc_type* __desc = __state._M_get_out_descriptor(); + const size_t __fmultiple = sizeof(intern_type); + size_t __fbytes = __fmultiple * (__from_end - __from); + const size_t __tmultiple = sizeof(extern_type); + size_t __tbytes = __tmultiple * (__to_end - __to); + + // Argument list for iconv specifies a byte sequence. Thus, + // all to/from arrays must be brutally casted to char*. + char* __cto = reinterpret_cast<char*>(__to); + char* __cfrom; + size_t __conv; + + // Some encodings need a byte order marker as the first item + // in the byte stream, to designate endian-ness. The default + // value for the byte order marker is NULL, so if this is + // the case, it's not necessary and we can just go on our + // merry way. + int __int_bom = __state._M_get_internal_bom(); + if (__int_bom) + { + size_t __size = __from_end - __from; + intern_type* __cfixed = static_cast<intern_type*>(__builtin_alloca(sizeof(intern_type) * (__size + 1))); + __cfixed[0] = static_cast<intern_type>(__int_bom); + char_traits<intern_type>::copy(__cfixed + 1, __from, __size); + __cfrom = reinterpret_cast<char*>(__cfixed); + __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, + &__fbytes, &__cto, &__tbytes); + } + else + { + intern_type* __cfixed = const_cast<intern_type*>(__from); + __cfrom = reinterpret_cast<char*>(__cfixed); + __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, &__fbytes, + &__cto, &__tbytes); + } + + if (__conv != size_t(-1)) + { + __from_next = reinterpret_cast<const intern_type*>(__cfrom); + __to_next = reinterpret_cast<extern_type*>(__cto); + __ret = ok; + } + else + { + if (__fbytes < __fmultiple * (__from_end - __from)) + { + __from_next = reinterpret_cast<const intern_type*>(__cfrom); + __to_next = reinterpret_cast<extern_type*>(__cto); + __ret = partial; + } + else + __ret = error; + } + } + return __ret; + } + + template<typename _InternT, typename _ExternT> + codecvt_base::result + codecvt<_InternT, _ExternT, __enc_traits>:: + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const + { + result __ret = error; + if (__state._M_good()) + { + typedef state_type::__desc_type __desc_type; + const __desc_type* __desc = __state._M_get_in_descriptor(); + const size_t __tmultiple = sizeof(intern_type); + size_t __tlen = __tmultiple * (__to_end - __to); + + // Argument list for iconv specifies a byte sequence. Thus, + // all to/from arrays must be brutally casted to char*. + char* __cto = reinterpret_cast<char*>(__to); + size_t __conv = __iconv_adaptor(iconv,*__desc, NULL, NULL, + &__cto, &__tlen); + + if (__conv != size_t(-1)) + { + __to_next = reinterpret_cast<extern_type*>(__cto); + if (__tlen == __tmultiple * (__to_end - __to)) + __ret = noconv; + else if (__tlen == 0) + __ret = ok; + else + __ret = partial; + } + else + __ret = error; + } + return __ret; + } + + template<typename _InternT, typename _ExternT> + codecvt_base::result + codecvt<_InternT, _ExternT, __enc_traits>:: + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const + { + result __ret = error; + if (__state._M_good()) + { + typedef state_type::__desc_type __desc_type; + const __desc_type* __desc = __state._M_get_in_descriptor(); + const size_t __fmultiple = sizeof(extern_type); + size_t __flen = __fmultiple * (__from_end - __from); + const size_t __tmultiple = sizeof(intern_type); + size_t __tlen = __tmultiple * (__to_end - __to); + + // Argument list for iconv specifies a byte sequence. Thus, + // all to/from arrays must be brutally casted to char*. + char* __cto = reinterpret_cast<char*>(__to); + char* __cfrom; + size_t __conv; + + // Some encodings need a byte order marker as the first item + // in the byte stream, to designate endian-ness. The default + // value for the byte order marker is NULL, so if this is + // the case, it's not necessary and we can just go on our + // merry way. + int __ext_bom = __state._M_get_external_bom(); + if (__ext_bom) + { + size_t __size = __from_end - __from; + extern_type* __cfixed = static_cast<extern_type*>(__builtin_alloca(sizeof(extern_type) * (__size + 1))); + __cfixed[0] = static_cast<extern_type>(__ext_bom); + char_traits<extern_type>::copy(__cfixed + 1, __from, __size); + __cfrom = reinterpret_cast<char*>(__cfixed); + __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, + &__flen, &__cto, &__tlen); + } + else + { + extern_type* __cfixed = const_cast<extern_type*>(__from); + __cfrom = reinterpret_cast<char*>(__cfixed); + __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, + &__flen, &__cto, &__tlen); + } + + + if (__conv != size_t(-1)) + { + __from_next = reinterpret_cast<const extern_type*>(__cfrom); + __to_next = reinterpret_cast<intern_type*>(__cto); + __ret = ok; + } + else + { + if (__flen < static_cast<size_t>(__from_end - __from)) + { + __from_next = reinterpret_cast<const extern_type*>(__cfrom); + __to_next = reinterpret_cast<intern_type*>(__cto); + __ret = partial; + } + else + __ret = error; + } + } + return __ret; + } + + template<typename _InternT, typename _ExternT> + int + codecvt<_InternT, _ExternT, __enc_traits>:: + do_encoding() const throw() + { + int __ret = 0; + if (sizeof(_ExternT) <= sizeof(_InternT)) + __ret = sizeof(_InternT)/sizeof(_ExternT); + return __ret; + } + + template<typename _InternT, typename _ExternT> + bool + codecvt<_InternT, _ExternT, __enc_traits>:: + do_always_noconv() const throw() + { return false; } + + template<typename _InternT, typename _ExternT> + int + codecvt<_InternT, _ExternT, __enc_traits>:: + do_length(const state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const + { return min(__max, static_cast<size_t>(__end - __from)); } + +#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS +// 74. Garbled text for codecvt::do_max_length + template<typename _InternT, typename _ExternT> + int + codecvt<_InternT, _ExternT, __enc_traits>:: + do_max_length() const throw() + { return 1; } +#endif diff --git a/contrib/libstdc++/config/locale/ieee_1003.1-2001/messages_members.cc b/contrib/libstdc++/config/locale/ieee_1003.1-2001/messages_members.cc new file mode 100644 index 0000000..0f667d6 --- /dev/null +++ b/contrib/libstdc++/config/locale/ieee_1003.1-2001/messages_members.cc @@ -0,0 +1,49 @@ +// std::messages implementation details, IEEE 1003.1-200x version -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + +#include <locale> + +namespace std +{ + // Specializations + template<> + string + messages<char>::do_get(catalog __c, int __setid, int __msgid, + const string& __dfault) const + { + nl_catd __nlc = reinterpret_cast<nl_catd>(__c); + return string(catgets(__nlc, __setid, __msgid, __dfault.c_str())); + } +} diff --git a/contrib/libstdc++/config/locale/ieee_1003.1-2001/messages_members.h b/contrib/libstdc++/config/locale/ieee_1003.1-2001/messages_members.h new file mode 100644 index 0000000..ce82eb8 --- /dev/null +++ b/contrib/libstdc++/config/locale/ieee_1003.1-2001/messages_members.h @@ -0,0 +1,70 @@ +// std::messages implementation details, IEEE 1003.1-200x version -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions +// + +// Written by Benjamin Kosnik <bkoz@redhat.com> + + // Non-virtual member functions. + template<typename _CharT> + typename messages<_CharT>::catalog + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, + const char*) const + { return this->do_open(__s, __loc); } + + // Virtual member functions. + template<typename _CharT> + messages<_CharT>::~messages() + { } + + template<typename _CharT> + typename messages<_CharT>::catalog + messages<_CharT>::do_open(const basic_string<char>& __s, + const locale&) const + { return reinterpret_cast<catalog>(catopen(__s.c_str(), NL_CAT_LOCALE)); } + + template<typename _CharT> + typename messages<_CharT>::string_type + messages<_CharT>::do_get(catalog __c, int __setid, int __msgid, + const string_type& __dfault) const + { + nl_catd __nlc = reinterpret_cast<nl_catd>(__c); + char* __msg = catgets(__nlc, __setid, __msgid, + _M_convert_to_char(__dfault)); + return _M_convert_from_char(__msg); + } + + template<typename _CharT> + void + messages<_CharT>::do_close(catalog __c) const + { catclose(reinterpret_cast<nl_catd>(__c)); } + + diff --git a/contrib/libstdc++/config/os/aix/bits/atomicity.h b/contrib/libstdc++/config/os/aix/bits/atomicity.h new file mode 100644 index 0000000..ecac7da --- /dev/null +++ b/contrib/libstdc++/config/os/aix/bits/atomicity.h @@ -0,0 +1,59 @@ +// Low-level functions for atomic operations: AIX version -*- C++ -*- + +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +/* We cannot use the cpu/powerpc/bits/atomicity.h inline assembly + definitions for these operations since they depend on operations + that are not available on the original POWER architecture. AIX + still runs on the POWER architecture, so it would be incorrect to + assume the existence of these instructions. */ + +/* This should match the type pointed to by atomic_p in + <sys/atomic_op.h>. */ +typedef int _Atomic_word; + +#include <sys/atomic_op.h> + +static inline int +__attribute__ ((unused)) +__exchange_and_add (atomic_p __mem, int __val) +{ + return fetch_and_add (__mem, __val); +} + +static inline void +__attribute__ ((unused)) +__atomic_add (atomic_p __mem, int __val) +{ + (void) fetch_and_add (__mem, __val); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/os/aix/bits/ctype_base.h b/contrib/libstdc++/config/os/aix/bits/ctype_base.h new file mode 100644 index 0000000..ed41440 --- /dev/null +++ b/contrib/libstdc++/config/os/aix/bits/ctype_base.h @@ -0,0 +1,55 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 1999 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned int mask; + static const mask upper = _ISUPPER; + static const mask lower = _ISLOWER; + static const mask alpha = _ISALPHA; + static const mask digit = _ISDIGIT; + static const mask xdigit = _ISXDIGIT; + static const mask space = _ISSPACE; + static const mask print = _ISPRINT; + static const mask graph = _ISGRAPH; + static const mask cntrl = _ISCNTRL; + static const mask punct = _ISPUNCT; + static const mask alnum = _ISALNUM; + }; diff --git a/contrib/libstdc++/config/os/aix/bits/ctype_inline.h b/contrib/libstdc++/config/os/aix/bits/ctype_inline.h new file mode 100644 index 0000000..d9df620 --- /dev/null +++ b/contrib/libstdc++/config/os/aix/bits/ctype_inline.h @@ -0,0 +1,76 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return __OBJ_DATA(__lc_ctype)->mask[__c] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = __OBJ_DATA(__lc_ctype)->mask[*__low++]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } + + + + + + + + + diff --git a/contrib/libstdc++/config/os/aix/bits/ctype_noninline.h b/contrib/libstdc++/config/os/aix/bits/ctype_noninline.h new file mode 100644 index 0000000..5dff2d1 --- /dev/null +++ b/contrib/libstdc++/config/os/aix/bits/ctype_noninline.h @@ -0,0 +1,81 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + char + ctype<char>::do_toupper(char __c) const + { return _toupper(__c); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_toupper(*__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return _tolower(__c); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_tolower(*__low); + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/aix/bits/os_defines.h b/contrib/libstdc++/config/os/aix/bits/os_defines.h new file mode 100644 index 0000000..6a658a1 --- /dev/null +++ b/contrib/libstdc++/config/os/aix/bits/os_defines.h @@ -0,0 +1,67 @@ +// Specific definitions for AIX -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 500 +#undef _XOPEN_SOURCE_EXTENDED +#define _XOPEN_SOURCE_EXTENDED 1 + +// off64_t +#ifndef _LARGE_FILE_API +#define _LARGE_FILE_API +#endif + +// atomic types +#ifndef _ALL_SOURCE +#define _ALL_SOURCE +#endif + +#define __off_t off_t +#define __off64_t off64_t +#define __ssize_t ssize_t + +#undef _G_USING_THUNKS +#define _G_USING_THUNKS 0 + +#if !defined(_AIX51) || !defined(__64BIT__) +#define __glibcpp_wchar_t_bits 16 +#define __glibcpp_wchar_t_is_signed false +#endif + +#ifdef __64BIT__ +#define __glibcpp_long_bits 64 +#endif + +#endif diff --git a/contrib/libstdc++/config/os/bsd/freebsd/bits/ctype_base.h b/contrib/libstdc++/config/os/bsd/freebsd/bits/ctype_base.h new file mode 100644 index 0000000..98b6265 --- /dev/null +++ b/contrib/libstdc++/config/os/bsd/freebsd/bits/ctype_base.h @@ -0,0 +1,76 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h on FreeBSD 3.4, +// 4.0 and all versions of the CVS managed file at: +// :pserver:anoncvs@anoncvs.freebsd.org:/home/ncvs/src/include/ctype.h + + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned long mask; +#ifdef _CTYPE_S + // FreeBSD 4.0 uses this style of define. + static const mask upper = _CTYPE_U; + static const mask lower = _CTYPE_L; + static const mask alpha = _CTYPE_A; + static const mask digit = _CTYPE_D; + static const mask xdigit = _CTYPE_X; + static const mask space = _CTYPE_S; + static const mask print = _CTYPE_R; + static const mask graph = _CTYPE_G; + static const mask cntrl = _CTYPE_C; + static const mask punct = _CTYPE_P; + static const mask alnum = _CTYPE_A | _CTYPE_D; +#else + // Older versions, including Free BSD 3.4, use this style of define. + static const mask upper = _U; + static const mask lower = _L; + static const mask alpha = _A; + static const mask digit = _D; + static const mask xdigit = _X; + static const mask space = _S; + static const mask print = _R; + static const mask graph = _G; + static const mask cntrl = _C; + static const mask punct = _P; + static const mask alnum = _A | _D; +#endif + }; + + + diff --git a/contrib/libstdc++/config/os/bsd/freebsd/bits/ctype_inline.h b/contrib/libstdc++/config/os/bsd/freebsd/bits/ctype_inline.h new file mode 100644 index 0000000..b4ba03f --- /dev/null +++ b/contrib/libstdc++/config/os/bsd/freebsd/bits/ctype_inline.h @@ -0,0 +1,94 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { + return __istype(__c, __m); + } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + for (;__low < __high; ++__vec, ++__low) + { +#if defined (_CTYPE_S) || defined (__istype) + *__vec = __maskrune (*__low, upper | lower | alpha | digit | xdigit + | space | print | graph | cntrl | punct | alnum); +#else + mask __m = 0; + if (this->is(upper, *__low)) __m |= upper; + if (this->is(lower, *__low)) __m |= lower; + if (this->is(alpha, *__low)) __m |= alpha; + if (this->is(digit, *__low)) __m |= digit; + if (this->is(xdigit, *__low)) __m |= xdigit; + if (this->is(space, *__low)) __m |= space; + if (this->is(print, *__low)) __m |= print; + if (this->is(graph, *__low)) __m |= graph; + if (this->is(cntrl, *__low)) __m |= cntrl; + if (this->is(punct, *__low)) __m |= punct; + // Do not include explicit line for alnum mask since it is a + // pure composite of masks on FreeBSD. + *__vec = __m; +#endif + } + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } + + + + + diff --git a/contrib/libstdc++/config/os/bsd/freebsd/bits/ctype_noninline.h b/contrib/libstdc++/config/os/bsd/freebsd/bits/ctype_noninline.h new file mode 100644 index 0000000..0e108fd --- /dev/null +++ b/contrib/libstdc++/config/os/bsd/freebsd/bits/ctype_noninline.h @@ -0,0 +1,81 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + char + ctype<char>::do_toupper(char __c) const + { return ::toupper((int) __c); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::toupper((int) *__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return ::tolower((int) __c); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::tolower((int) *__low); + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/bsd/freebsd/bits/os_defines.h b/contrib/libstdc++/config/os/bsd/freebsd/bits/os_defines.h new file mode 100644 index 0000000..cfc917f --- /dev/null +++ b/contrib/libstdc++/config/os/bsd/freebsd/bits/os_defines.h @@ -0,0 +1,39 @@ +// Specific definitions for BSD -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#define __glibcpp_long_double_bits __glibcpp_double_bits + +#endif diff --git a/contrib/libstdc++/config/os/bsd/netbsd/bits/ctype_base.h b/contrib/libstdc++/config/os/bsd/netbsd/bits/ctype_base.h new file mode 100644 index 0000000..ceea8ac --- /dev/null +++ b/contrib/libstdc++/config/os/bsd/netbsd/bits/ctype_base.h @@ -0,0 +1,58 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h on NetBSD. +// Full details can be found from the CVS files at: +// anoncvs@anoncvs.netbsd.org:/cvsroot/basesrc/include/ctype.h +// See www.netbsd.org for details of access. + + struct ctype_base + { + // Non-standard typedefs. + typedef const unsigned char* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned char mask; + static const mask upper = _U; + static const mask lower = _L; + static const mask alpha = _U | _L; + static const mask digit = _N; + static const mask xdigit = _N | _X; + static const mask space = _S; + static const mask print = _P | _U | _L | _N | _B; + static const mask graph = _P | _U | _L | _N; + static const mask cntrl = _C; + static const mask punct = _P; + static const mask alnum = _U | _L | _N; + }; diff --git a/contrib/libstdc++/config/os/bsd/netbsd/bits/ctype_inline.h b/contrib/libstdc++/config/os/bsd/netbsd/bits/ctype_inline.h new file mode 100644 index 0000000..f6dfc4d --- /dev/null +++ b/contrib/libstdc++/config/os/bsd/netbsd/bits/ctype_inline.h @@ -0,0 +1,73 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return _M_table[(unsigned char)(__c)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = _M_table[*__low++]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } + + + + + + diff --git a/contrib/libstdc++/config/os/bsd/netbsd/bits/ctype_noninline.h b/contrib/libstdc++/config/os/bsd/netbsd/bits/ctype_noninline.h new file mode 100644 index 0000000..80138cb --- /dev/null +++ b/contrib/libstdc++/config/os/bsd/netbsd/bits/ctype_noninline.h @@ -0,0 +1,79 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _ctype_ + 1) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _ctype_ + 1) + { } + + char + ctype<char>::do_toupper(char __c) const + { return ::toupper((int) __c); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::toupper((int) *__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return ::tolower((int) __c); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::tolower((int) *__low); + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/bsd/netbsd/bits/os_defines.h b/contrib/libstdc++/config/os/bsd/netbsd/bits/os_defines.h new file mode 100644 index 0000000..03f760f --- /dev/null +++ b/contrib/libstdc++/config/os/bsd/netbsd/bits/os_defines.h @@ -0,0 +1,38 @@ +// Specific definitions for NetBSD -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#define __ssize_t ssize_t + +#endif diff --git a/contrib/libstdc++/config/os/djgpp/bits/ctype_base.h b/contrib/libstdc++/config/os/djgpp/bits/ctype_base.h new file mode 100644 index 0000000..018e20e --- /dev/null +++ b/contrib/libstdc++/config/os/djgpp/bits/ctype_base.h @@ -0,0 +1,57 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + + struct ctype_base + { + typedef unsigned short mask; + + // Non-standard typedefs. + typedef unsigned char * __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + static const mask space = __dj_ISSPACE; // Whitespace + static const mask print = __dj_ISPRINT; // Printing + static const mask cntrl = __dj_ISCNTRL; // Control character + static const mask upper = __dj_ISUPPER; // UPPERCASE + static const mask lower = __dj_ISLOWER; // lowercase + static const mask alpha = __dj_ISALPHA; // Alphabetic + static const mask digit = __dj_ISDIGIT; // Numeric + static const mask punct = __dj_ISPUNCT; // Punctuation + static const mask xdigit = __dj_ISXDIGIT; // Hexadecimal numeric + static const mask alnum = __dj_ISALPHA; // Alphanumeric + static const mask graph = __dj_ISGRAPH; // Graphical + }; + + + diff --git a/contrib/libstdc++/config/os/djgpp/bits/ctype_inline.h b/contrib/libstdc++/config/os/djgpp/bits/ctype_inline.h new file mode 100644 index 0000000..21958c4 --- /dev/null +++ b/contrib/libstdc++/config/os/djgpp/bits/ctype_inline.h @@ -0,0 +1,67 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return _M_table[static_cast<unsigned char>(__c + 1)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } diff --git a/contrib/libstdc++/config/os/djgpp/bits/ctype_noninline.h b/contrib/libstdc++/config/os/djgpp/bits/ctype_noninline.h new file mode 100644 index 0000000..0ec0f84 --- /dev/null +++ b/contrib/libstdc++/config/os/djgpp/bits/ctype_noninline.h @@ -0,0 +1,81 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from DJGPP <ctype.h> + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower), + _M_table(__table ? __table : __dj_ctype_flags) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower), + _M_table(__table ? __table : __dj_ctype_flags) + { } + + char + ctype<char>::do_toupper(char __c) const + { return _M_toupper[static_cast<int>(__c)+1]; } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::toupper(static_cast<int> (*__low)); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return _M_tolower[static_cast<int>(__c)+1]; } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::tolower(static_cast<int> (*__low)); + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/djgpp/bits/os_defines.h b/contrib/libstdc++/config/os/djgpp/bits/os_defines.h new file mode 100644 index 0000000..ce0bf24 --- /dev/null +++ b/contrib/libstdc++/config/os/djgpp/bits/os_defines.h @@ -0,0 +1,45 @@ +// Specific definitions for DJGPP -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#define __off_t off_t +#define __off64_t off64_t +#define __ssize_t ssize_t + +// FIXME: should there be '#undef POSIX_SOURCE'? + +#endif + + diff --git a/contrib/libstdc++/config/os/generic/bits/ctype_base.h b/contrib/libstdc++/config/os/generic/bits/ctype_base.h new file mode 100644 index 0000000..564093d --- /dev/null +++ b/contrib/libstdc++/config/os/generic/bits/ctype_base.h @@ -0,0 +1,58 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Default information, may not be appropriate for specific host. + + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned int mask; + static const mask upper = 1 << 0; + static const mask lower = 1 << 1; + static const mask alpha = 1 << 2; + static const mask digit = 1 << 3; + static const mask xdigit = 1 << 4; + static const mask space = 1 << 5; + static const mask print = 1 << 6; + static const mask graph = 1 << 7; + static const mask cntrl = 1 << 8; + static const mask punct = 1 << 9; + static const mask alnum = 1 << 10; + }; + + + diff --git a/contrib/libstdc++/config/os/generic/bits/ctype_inline.h b/contrib/libstdc++/config/os/generic/bits/ctype_inline.h new file mode 100644 index 0000000..c10cb56 --- /dev/null +++ b/contrib/libstdc++/config/os/generic/bits/ctype_inline.h @@ -0,0 +1,125 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + +// The following definitions are portable, but insanely slow. If one +// cares at all about performance, then specialized ctype +// functionality should be added for the native os in question: see +// the config/os/bits/ctype_*.h files. + + bool + ctype<char>:: + is(mask __m, char __c) const + { + bool __ret; + switch (__m) + { + case space: + __ret = isspace(__c); + break; + case print: + __ret = isprint(__c); + break; + case cntrl: + __ret = iscntrl(__c); + break; + case upper: + __ret = isupper(__c); + break; + case lower: + __ret = islower(__c); + break; + case alpha: + __ret = isalpha(__c); + break; + case digit: + __ret = isdigit(__c); + break; + case punct: + __ret = ispunct(__c); + break; + case xdigit: + __ret = isxdigit(__c); + break; + case alnum: + __ret = isalnum(__c); + break; + case graph: + __ret = isgraph(__c); + break; + default: + __ret = false; + break; + } + return __ret; + } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + const int __bitmasksize = 11; // Highest bitmask in ctype_base == 10 + for (;__low < __high; ++__vec, ++__low) + { + mask __m = 0; + int __i = 0; // Lowest bitmask in ctype_base == 0 + for (;__i < __bitmasksize; ++__i) + { + mask __bit = static_cast<mask>(1 << __i); + if (this->is(__bit, *__low)) + __m |= __bit; + } + *__vec = __m; + } + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } diff --git a/contrib/libstdc++/config/os/generic/bits/ctype_noninline.h b/contrib/libstdc++/config/os/generic/bits/ctype_noninline.h new file mode 100644 index 0000000..9fec00b --- /dev/null +++ b/contrib/libstdc++/config/os/generic/bits/ctype_noninline.h @@ -0,0 +1,82 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table == 0 ? classic_table() : __table) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table == 0 ? classic_table() : __table) + { } + + char + ctype<char>::do_toupper(char __c) const + { return ::toupper((int) __c); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::toupper((int) *__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return ::tolower((int) __c); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::tolower((int) *__low); + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/generic/bits/os_defines.h b/contrib/libstdc++/config/os/generic/bits/os_defines.h new file mode 100644 index 0000000..143c07e --- /dev/null +++ b/contrib/libstdc++/config/os/generic/bits/os_defines.h @@ -0,0 +1,37 @@ +// Specific definitions for generic platforms -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#endif diff --git a/contrib/libstdc++/config/os/gnu-linux/bits/ctype_base.h b/contrib/libstdc++/config/os/gnu-linux/bits/ctype_base.h new file mode 100644 index 0000000..50a5f79 --- /dev/null +++ b/contrib/libstdc++/config/os/gnu-linux/bits/ctype_base.h @@ -0,0 +1,69 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + +#if _GLIBCPP_USE_SHADOW_HEADERS + using _C_legacy::_ISspace; + using _C_legacy::_ISprint; + using _C_legacy::_IScntrl; + using _C_legacy::_ISupper; + using _C_legacy::_ISlower; + using _C_legacy::_ISalpha; + using _C_legacy::_ISdigit; + using _C_legacy::_ISpunct; + using _C_legacy::_ISxdigit; + using _C_legacy::_ISalnum; + using _C_legacy::_ISgraph; +#endif + + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned short mask; + static const mask upper = _ISupper; + static const mask lower = _ISlower; + static const mask alpha = _ISalpha; + static const mask digit = _ISdigit; + static const mask xdigit = _ISxdigit; + static const mask space = _ISspace; + static const mask print = _ISprint; + static const mask graph = _ISgraph; + static const mask cntrl = _IScntrl; + static const mask punct = _ISpunct; + static const mask alnum = _ISalnum; + }; diff --git a/contrib/libstdc++/config/os/gnu-linux/bits/ctype_inline.h b/contrib/libstdc++/config/os/gnu-linux/bits/ctype_inline.h new file mode 100644 index 0000000..af409c8 --- /dev/null +++ b/contrib/libstdc++/config/os/gnu-linux/bits/ctype_inline.h @@ -0,0 +1,69 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return _M_table[static_cast<unsigned char>(__c)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) + ++__low; + return __low; + } diff --git a/contrib/libstdc++/config/os/gnu-linux/bits/ctype_noninline.h b/contrib/libstdc++/config/os/gnu-linux/bits/ctype_noninline.h new file mode 100644 index 0000000..ee70ab4 --- /dev/null +++ b/contrib/libstdc++/config/os/gnu-linux/bits/ctype_noninline.h @@ -0,0 +1,100 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + +#if _GLIBCPP_USE_SHADOW_HEADERS + using _C_legacy::__ctype_toupper; + using _C_legacy::__ctype_tolower; + using _C_legacy::__ctype_b; +#endif + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return __ctype_b; } + +#if _GLIBCPP_C_LOCALE_GNU + ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del) + { + _M_c_locale_ctype = _S_clone_c_locale(__cloc); + _M_toupper = _M_c_locale_ctype->__ctype_toupper; + _M_tolower = _M_c_locale_ctype->__ctype_tolower; + _M_table = __table ? __table : _M_c_locale_ctype->__ctype_b; + } +#else + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), + _M_table(__table ? __table : classic_table()) + { _M_c_locale_ctype = _S_c_locale; } +#endif + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : + __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), + _M_table(__table ? __table : classic_table()) + { _M_c_locale_ctype = _S_c_locale; } + + char + ctype<char>::do_toupper(char __c) const + { return _M_toupper[static_cast<unsigned char>(__c)]; } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = _M_toupper[static_cast<unsigned char>(*__low)]; + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return _M_tolower[static_cast<unsigned char>(__c)]; } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = _M_tolower[static_cast<unsigned char>(*__low)]; + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/gnu-linux/bits/os_defines.h b/contrib/libstdc++/config/os/gnu-linux/bits/os_defines.h new file mode 100644 index 0000000..d5ed77c --- /dev/null +++ b/contrib/libstdc++/config/os/gnu-linux/bits/os_defines.h @@ -0,0 +1,76 @@ +// Specific definitions for GNU/Linux -*- C++ -*- + +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +// This keeps isanum, et al from being propagated as macros. +#define __NO_CTYPE 1 + +#include <features.h> + +#if !defined (__GLIBC__) || (__GLIBC__ == 2 && __GLIBC_MINOR__+ 0 == 0) + +// The types __off_t and __off64_t are not defined through <sys/types.h> +// as _G_config assumes. For libc5 and glibc 2.0 instead use +// <gnu/types.h> and the old name for __off64_t. +#include <gnu/types.h> +typedef __loff_t __off64_t; + +// These systems have declarations mismatching those in libio.h by +// omitting throw qualifiers. Cleanest way out is to not provide +// throw-qualifiers at all. Defining it as empty here will make libio.h +// not define it. +#undef __THROW +#define __THROW + +// Tell Glibc not to try to provide its own inline versions of +// some math functions. Those cause assembly-time clashes with +// our definitions. +#define __NO_MATH_INLINES + +#endif + +#if defined __GLIBC__ && __GLIBC__ >= 2 +// We must not see the optimized string functions GNU libc defines. +#define __NO_STRING_INLINES +#endif + +#if defined(__powerpc64__) || defined(__s390x__) || (defined(__sparc__) && defined(__arch64__)) +#define __glibcpp_long_bits 64 +#endif + +#if defined(__sparc__) && !defined(__arch64__) +#define __glibcpp_long_double_bits 64 +#endif + +#endif diff --git a/contrib/libstdc++/config/os/hpux/bits/cpu_limits.h b/contrib/libstdc++/config/os/hpux/bits/cpu_limits.h new file mode 100644 index 0000000..1c28295 --- /dev/null +++ b/contrib/libstdc++/config/os/hpux/bits/cpu_limits.h @@ -0,0 +1,35 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#ifdef __LP64__ +#define __glibcpp_long_bits 64 +#endif + +#endif diff --git a/contrib/libstdc++/config/os/hpux/bits/ctype_base.h b/contrib/libstdc++/config/os/hpux/bits/ctype_base.h new file mode 100644 index 0000000..f2f6ad0 --- /dev/null +++ b/contrib/libstdc++/config/os/hpux/bits/ctype_base.h @@ -0,0 +1,55 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Default information, may not be appropriate for specific host. + + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned int mask; + static const mask upper = _ISUPPER; + static const mask lower = _ISLOWER; + static const mask alpha = _ISALPHA; + static const mask digit = _ISDIGIT; + static const mask xdigit = _ISXDIGIT; + static const mask space = _ISSPACE; + static const mask print = _ISPRINT; + static const mask graph = _ISGRAPH; + static const mask cntrl = _ISCNTRL; + static const mask punct = _ISPUNCT; + static const mask alnum = _ISALNUM; + }; diff --git a/contrib/libstdc++/config/os/hpux/bits/ctype_inline.h b/contrib/libstdc++/config/os/hpux/bits/ctype_inline.h new file mode 100644 index 0000000..35cc306 --- /dev/null +++ b/contrib/libstdc++/config/os/hpux/bits/ctype_inline.h @@ -0,0 +1,79 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return _M_table[(unsigned char)(__c)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + const int __bitmasksize = 11; // Highest bitmask in ctype_base == 10 + for (;__low < __high; ++__vec, ++__low) + { + mask __m = _M_table[*__low]; + int __i = 0; // Lowest bitmask in ctype_base == 0 + while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) + ++__i; + *__vec = static_cast<mask>(1 << __i); + } + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } + + + + + diff --git a/contrib/libstdc++/config/os/hpux/bits/ctype_noninline.h b/contrib/libstdc++/config/os/hpux/bits/ctype_noninline.h new file mode 100644 index 0000000..7ec3b30 --- /dev/null +++ b/contrib/libstdc++/config/os/hpux/bits/ctype_noninline.h @@ -0,0 +1,82 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : (const mask *) __SB_masks) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : (const mask *) __SB_masks) + { } + + char + ctype<char>::do_toupper(char __c) const + { return ::toupper((int) __c); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::toupper((int) *__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return ::tolower((int) __c); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = ::tolower((int) *__low); + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/hpux/bits/os_defines.h b/contrib/libstdc++/config/os/hpux/bits/os_defines.h new file mode 100644 index 0000000..c8a6c9d --- /dev/null +++ b/contrib/libstdc++/config/os/hpux/bits/os_defines.h @@ -0,0 +1,79 @@ +// Specific definitions for generic platforms -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#define __off_t off_t +#define __off64_t off64_t +#define __ssize_t ssize_t + +#define __glibcpp_wchar_t_is_signed false + +// Use macro form of ctype functions to ensure __SB_masks is defined. +#define _SB_CTYPE_MACROS 1 + +/* HP-UX, for reasons unknown choose to use a different name for + the string to [unsigned] long long conversion routines. + + Furthermore, instead of having the prototypes in stdlib.h like + everyone else, they put them into a non-standard header + <inttypes.h>. Ugh. + + <inttypes.h> defines a variety of things, some of which we + probably do not want. So we don't want to include it here. + + Luckily we can just declare strtoll and strtoull with the + __asm extension which effectively renames calls at the + source level without namespace pollution. + + Also note that the compiler defines _INCLUDE_LONGLONG for C++ + unconditionally, which makes intmax_t and uintmax_t long long + types. + + We also force _GLIBCPP_USE_LONG_LONG here so that we don't have + to bastardize configure to deal with this sillyness. */ +namespace std { +#ifndef __LP64__ + __extension__ extern "C" long long strtoll (const char *, char **, int) + __asm ("__strtoll"); + __extension__ extern "C" unsigned long long strtoull (const char *, char **, int) + __asm ("__strtoull"); +#else + __extension__ extern "C" long long strtoll (const char *, char **, int) + __asm ("strtol"); + __extension__ extern "C" unsigned long long strtoull (const char *, char **, int) + __asm ("strtoul"); +#endif +} +#define _GLIBCPP_USE_LONG_LONG 1 +#endif diff --git a/contrib/libstdc++/config/os/irix/irix5.2/bits/atomicity.h b/contrib/libstdc++/config/os/irix/irix5.2/bits/atomicity.h new file mode 100644 index 0000000..bac483e --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix5.2/bits/atomicity.h @@ -0,0 +1,50 @@ +// Low-level functions for atomic operations: IRIX version -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +#include <mutex.h> + +typedef long _Atomic_word; + +static inline _Atomic_word +__exchange_and_add (_Atomic_word* __mem, int __val) +{ + return (_Atomic_word) test_then_add ((unsigned long*) __mem, __val); +} + + +static inline void +__atomic_add (_Atomic_word* __mem, int __val) +{ + __exchange_and_add (__mem, __val); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/os/irix/irix5.2/bits/ctype_base.h b/contrib/libstdc++/config/os/irix/irix5.2/bits/ctype_base.h new file mode 100644 index 0000000..2626cd3 --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix5.2/bits/ctype_base.h @@ -0,0 +1,55 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-1999, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h on irix 5.2 + + struct ctype_base + { + // Non-standard typedefs. + typedef unsigned int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned char mask; + static const mask upper = _U; + static const mask lower = _L; + static const mask alpha = _U | _L; + static const mask digit = _N; + static const mask xdigit = _X; + static const mask space = _S; + static const mask print = _U | _L | _N | _P | _B; + static const mask graph = _U | _L | _N | _P; + static const mask cntrl = _C; + static const mask punct = _P; + static const mask alnum = _U | _L | _N; + }; diff --git a/contrib/libstdc++/config/os/irix/irix5.2/bits/ctype_inline.h b/contrib/libstdc++/config/os/irix/irix5.2/bits/ctype_inline.h new file mode 100644 index 0000000..400b3a7 --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix5.2/bits/ctype_inline.h @@ -0,0 +1,72 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return (_M_table)[__c] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = (_M_table)[*__low++]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !((_M_table)[*__low] & __m)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && ((_M_table + 1)[*__low] & __m) != 0) + ++__low; + return __low; + } + + + + + diff --git a/contrib/libstdc++/config/os/irix/irix5.2/bits/ctype_noninline.h b/contrib/libstdc++/config/os/irix/irix5.2/bits/ctype_noninline.h new file mode 100644 index 0000000..f9df21f --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix5.2/bits/ctype_noninline.h @@ -0,0 +1,83 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2001, 2002 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(!__table ? __ctype : __table) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(!__table ? __ctype : __table) + { } + + char + ctype<char>::do_toupper(char __c) const + { return _toupper(__c); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = do_toupper(*__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return _tolower(__c); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = do_tolower(*__low); + ++__low; + } + return __high; + } + diff --git a/contrib/libstdc++/config/os/irix/irix5.2/bits/os_defines.h b/contrib/libstdc++/config/os/irix/irix5.2/bits/os_defines.h new file mode 100644 index 0000000..50db680 --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix5.2/bits/os_defines.h @@ -0,0 +1,54 @@ +// Specific definitions for IRIX -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +// We need large file support. There are two ways to turn it on: by +// defining either _LARGEFILE64_SOURCE or _SGI_SOURCE. However, it +// does not actually work to define only the former, as then +// <sys/stat.h> is invalid: `st_blocks' is defined to be a macro, but +// then used as a field name. So, we have to turn on _SGI_SOURCE. +// That only works if _POSIX_SOURCE is turned off, so we have to +// explicitly turn it off. (Some of the libio C files explicitly try +// to turn it on.) _SGI_SOURCE is actually turned on implicitly via +// the command-line. +#undef _POSIX_SOURCE + +#define __off_t off_t +#define __off64_t off64_t +#define __ssize_t ssize_t + +// GCC does not use thunks on IRIX. +#define _G_USING_THUNKS 0 + +#endif diff --git a/contrib/libstdc++/config/os/irix/irix6.5/bits/atomicity.h b/contrib/libstdc++/config/os/irix/irix6.5/bits/atomicity.h new file mode 100644 index 0000000..c7f5c83 --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix6.5/bits/atomicity.h @@ -0,0 +1,50 @@ +// Low-level functions for atomic operations: IRIX version -*- C++ -*- + +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +#include <mutex.h> + +typedef long _Atomic_word; + +static inline _Atomic_word +__exchange_and_add (_Atomic_word* __mem, int __val) +{ + return (_Atomic_word) test_then_add ((unsigned long*) __mem, __val); +} + + +static inline void +__atomic_add (_Atomic_word* __mem, int __val) +{ + __exchange_and_add (__mem, __val); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/os/irix/irix6.5/bits/ctype_base.h b/contrib/libstdc++/config/os/irix/irix6.5/bits/ctype_base.h new file mode 100644 index 0000000..08557d1 --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix6.5/bits/ctype_base.h @@ -0,0 +1,55 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h on irix 6.5 + + struct ctype_base + { + // Non-standard typedefs. + typedef int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned int mask; + static const mask upper = _ISupper; + static const mask lower = _ISlower; + static const mask alpha = _ISalpha; + static const mask digit = _ISdigit; + static const mask xdigit = _ISxdigit; + static const mask space = _ISspace; + static const mask print = _ISprint; + static const mask graph = _ISgraph; + static const mask cntrl = _IScntrl; + static const mask punct = _ISpunct; + static const mask alnum = _ISalnum; + }; diff --git a/contrib/libstdc++/config/os/irix/irix6.5/bits/ctype_inline.h b/contrib/libstdc++/config/os/irix/irix6.5/bits/ctype_inline.h new file mode 100644 index 0000000..b7ab12d --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix6.5/bits/ctype_inline.h @@ -0,0 +1,69 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return (_M_table)[static_cast<unsigned char>(__c)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = (_M_table)[static_cast<unsigned char>(*__low++)]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && !((_M_table)[static_cast<unsigned char>(*__low)] & __m)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && ((_M_table + 1)[static_cast<unsigned char>(*__low)] & __m) != 0) + ++__low; + return __low; + } diff --git a/contrib/libstdc++/config/os/irix/irix6.5/bits/ctype_noninline.h b/contrib/libstdc++/config/os/irix/irix6.5/bits/ctype_noninline.h new file mode 100644 index 0000000..009e611 --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix6.5/bits/ctype_noninline.h @@ -0,0 +1,84 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(!__table ? + (const mask*) (__libc_attr._ctype_tbl->_class + 1) : __table) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(!__table ? + (const mask*) (__libc_attr._ctype_tbl->_class + 1) : __table) + { } + + char + ctype<char>::do_toupper(char __c) const + { return _toupper(__c); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = do_toupper(*__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return _tolower(__c); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = do_tolower(*__low); + ++__low; + } + return __high; + } + diff --git a/contrib/libstdc++/config/os/irix/irix6.5/bits/os_defines.h b/contrib/libstdc++/config/os/irix/irix6.5/bits/os_defines.h new file mode 100644 index 0000000..e8f1dcc --- /dev/null +++ b/contrib/libstdc++/config/os/irix/irix6.5/bits/os_defines.h @@ -0,0 +1,62 @@ +// Specific definitions for IRIX -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +// We need large file support. There are two ways to turn it on: by +// defining either _LARGEFILE64_SOURCE or _SGI_SOURCE. However, it +// does not actually work to define only the former, as then +// <sys/stat.h> is invalid: `st_blocks' is defined to be a macro, but +// then used as a field name. So, we have to turn on _SGI_SOURCE. +// That only works if _POSIX_SOURCE is turned off, so we have to +// explicitly turn it off. (Some of the libio C files explicitly try +// to turn it on.) _SGI_SOURCE is actually turned on implicitly via +// the command-line. +#undef _POSIX_SOURCE + +#define __off_t off_t +#define __off64_t off64_t +#define __ssize_t ssize_t + +// GCC does not use thunks on IRIX. +#define _G_USING_THUNKS 0 + +#define __glibcpp_long_double_bits 64 + +#if __LONG_MAX__ > 2147483647 +#define __glibcpp_wchar_t_bits 64 +#define __glibcpp_long_bits 64 +#endif + +#endif + diff --git a/contrib/libstdc++/config/os/mingw32/bits/ctype_base.h b/contrib/libstdc++/config/os/mingw32/bits/ctype_base.h new file mode 100644 index 0000000..c077594 --- /dev/null +++ b/contrib/libstdc++/config/os/mingw32/bits/ctype_base.h @@ -0,0 +1,58 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information, as gleaned from /mingw32/include/ctype.h. + + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned short mask; + static const mask upper = _UPPER; + static const mask lower = _LOWER; + static const mask alpha = _ALPHA; + static const mask digit = _DIGIT; + static const mask xdigit = _HEX; + static const mask space = _SPACE; + static const mask print = (_BLANK | _PUNCT| _ALPHA | _DIGIT); + static const mask graph = (_PUNCT | _ALPHA | _DIGIT); + static const mask cntrl = _CONTROL; + static const mask punct = _PUNCT; + static const mask alnum = (_ALPHA | _DIGIT); + }; + + + diff --git a/contrib/libstdc++/config/os/mingw32/bits/ctype_inline.h b/contrib/libstdc++/config/os/mingw32/bits/ctype_inline.h new file mode 100644 index 0000000..979d607 --- /dev/null +++ b/contrib/libstdc++/config/os/mingw32/bits/ctype_inline.h @@ -0,0 +1,71 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + + bool + ctype<char>:: + is(mask __m, char __c) const + { + return (_M_table[static_cast<unsigned char>(__c) ] & __m); + } + + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !this->is(__m, *__low)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && this->is(__m, *__low) != 0) + ++__low; + return __low; + } diff --git a/contrib/libstdc++/config/os/mingw32/bits/ctype_noninline.h b/contrib/libstdc++/config/os/mingw32/bits/ctype_noninline.h new file mode 100644 index 0000000..998547c --- /dev/null +++ b/contrib/libstdc++/config/os/mingw32/bits/ctype_noninline.h @@ -0,0 +1,89 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /mingw32/include/ctype.h. + + // This should be in mingw's ctype.h but isn't in older versions + // Static classic C-locale table. _ctype[0] is EOF + extern "C" unsigned short __declspec(dllimport) _ctype[]; + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return _ctype + 1; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + char + ctype<char>::do_toupper(char __c) const + { return (this->is(ctype_base::lower, __c) ? (__c - 'a' + 'A') : __c); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_toupper(*__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return (this->is(ctype_base::upper, __c) ? (__c - 'A' + 'a') : __c); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_tolower(*__low); + ++__low; + } + return __high; + } + + + + diff --git a/contrib/libstdc++/config/os/mingw32/bits/os_defines.h b/contrib/libstdc++/config/os/mingw32/bits/os_defines.h new file mode 100644 index 0000000..5c99e09 --- /dev/null +++ b/contrib/libstdc++/config/os/mingw32/bits/os_defines.h @@ -0,0 +1,37 @@ +// Specific definitions for generic platforms -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + +#ifndef _GLIBCPP_OS_DEFINES +# define _GLIBCPP_OS_DEFINES + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#endif diff --git a/contrib/libstdc++/config/os/newlib/bits/ctype_base.h b/contrib/libstdc++/config/os/newlib/bits/ctype_base.h new file mode 100644 index 0000000..973d410 --- /dev/null +++ b/contrib/libstdc++/config/os/newlib/bits/ctype_base.h @@ -0,0 +1,57 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1 + +// Support for Solaris 2.5.1 + + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef char mask; + static const mask upper = _U; + static const mask lower = _L; + static const mask alpha = _U | _L; + static const mask digit = _N; + static const mask xdigit = _X | _N; + static const mask space = _S; + static const mask print = _P | _U | _L | _N | _B; + static const mask graph = _P | _U | _L | _N; + static const mask cntrl = _C; + static const mask punct = _P; + static const mask alnum = _U | _L | _N; + }; diff --git a/contrib/libstdc++/config/os/newlib/bits/ctype_inline.h b/contrib/libstdc++/config/os/newlib/bits/ctype_inline.h new file mode 100644 index 0000000..cddffed --- /dev/null +++ b/contrib/libstdc++/config/os/newlib/bits/ctype_inline.h @@ -0,0 +1,73 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return (_M_table + 1)[(unsigned char)(__c)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = (_M_table + 1)[(unsigned char) (*__low++)]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high && !((_M_table + 1)[(unsigned char)(*__low)] & __m)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && ((_M_table + 1)[(unsigned char)(*__low)] & __m) != 0) + ++__low; + return __low; + } + + + + + diff --git a/contrib/libstdc++/config/os/newlib/bits/ctype_noninline.h b/contrib/libstdc++/config/os/newlib/bits/ctype_noninline.h new file mode 100644 index 0000000..7cb1ece --- /dev/null +++ b/contrib/libstdc++/config/os/newlib/bits/ctype_noninline.h @@ -0,0 +1,88 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return _ctype_; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + char + ctype<char>::do_toupper(char __c) const + { + int __x = __c; + return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x); + } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_toupper(*__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { + int __x = __c; + return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x); + } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_tolower(*__low); + ++__low; + } + return __high; + } + diff --git a/contrib/libstdc++/config/os/newlib/bits/os_defines.h b/contrib/libstdc++/config/os/newlib/bits/os_defines.h new file mode 100644 index 0000000..1277661 --- /dev/null +++ b/contrib/libstdc++/config/os/newlib/bits/os_defines.h @@ -0,0 +1,36 @@ +// Specific definitions for newlib -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +#endif diff --git a/contrib/libstdc++/config/os/osf/osf5.0/bits/cpu_limits.h b/contrib/libstdc++/config/os/osf/osf5.0/bits/cpu_limits.h new file mode 100644 index 0000000..d74b15c --- /dev/null +++ b/contrib/libstdc++/config/os/osf/osf5.0/bits/cpu_limits.h @@ -0,0 +1,35 @@ +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_bits 64 + +#define __glibcpp_long_double_bits 128 + +#endif diff --git a/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ctype_base.h b/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ctype_base.h new file mode 100644 index 0000000..ad2babd --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ctype_base.h @@ -0,0 +1,55 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h, for solaris2.5.1 + + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned char mask; + static const mask upper = 01; + static const mask lower = 02; + static const mask alpha = 01 | 02; + static const mask digit = 04; + static const mask xdigit = 0200; + static const mask space = 010; + static const mask print = 020 | 01 | 02 | 04 | 0200; + static const mask graph = 020 | 01 | 02 | 04; + static const mask cntrl = 040; + static const mask punct = 020; + static const mask alnum = 01 | 02 | 04; + }; diff --git a/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ctype_inline.h b/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ctype_inline.h new file mode 100644 index 0000000..93a04aa --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ctype_inline.h @@ -0,0 +1,69 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-1999, 2000, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return (_M_table + 1)[static_cast<unsigned char>(__c)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = (_M_table + 1)[static_cast<unsigned char>(*__low++)]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && !((_M_table + 1)[static_cast<unsigned char>(*__low)] & __m)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && ((_M_table + 1)[static_cast<unsigned char>(*__low)] & __m) != 0) + ++__low; + return __low; + } diff --git a/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ctype_noninline.h b/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ctype_noninline.h new file mode 100644 index 0000000..f466afb --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.5/bits/ctype_noninline.h @@ -0,0 +1,81 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } + + char + ctype<char>::do_toupper(char __c) const + { return ((_M_table + 258)[static_cast<unsigned char>(__c)]); } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_toupper(*__low); + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return ((_M_table + 258)[static_cast<unsigned char>(__c)]); } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = this->do_tolower(*__low); + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/solaris/solaris2.5/bits/os_defines.h b/contrib/libstdc++/config/os/solaris/solaris2.5/bits/os_defines.h new file mode 100644 index 0000000..145ae66 --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.5/bits/os_defines.h @@ -0,0 +1,45 @@ +// Specific definitions for Solaris 2.5 -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +// These are typedefs which libio assumes are already in place (because +// they really are, under Linux). +#define __off_t off_t +#define __off64_t off64_t +#define __ssize_t ssize_t + +// Without this all the libio vtbls are offset wrongly. +#define _G_USING_THUNKS 0 + +#endif diff --git a/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ctype_base.h b/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ctype_base.h new file mode 100644 index 0000000..5f8d10a --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ctype_base.h @@ -0,0 +1,56 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h. Looks like this +// only works with solaris2.6. + + struct ctype_base + { + // Non-standard typedefs. + typedef long* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned int mask; + static const mask upper = _ISUPPER; + static const mask lower = _ISLOWER; + static const mask alpha = _ISALPHA; + static const mask digit = _ISDIGIT; + static const mask xdigit = _ISXDIGIT; + static const mask space = _ISSPACE; + static const mask print = _ISPRINT; + static const mask graph = _ISGRAPH; + static const mask cntrl = _ISCNTRL; + static const mask punct = _ISPUNCT; + static const mask alnum = _ISALNUM; + }; diff --git a/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ctype_inline.h b/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ctype_inline.h new file mode 100644 index 0000000..0bd56a1 --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ctype_inline.h @@ -0,0 +1,76 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return _M_table[static_cast<unsigned char>(__c)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + const int __bitmasksize = sizeof(mask) * 8; + for (;__low < __high; ++__vec, ++__low) + { + mask __m = _M_table[static_cast<unsigned char>(*__low)]; + int __i = 0; // Lowest bitmask value from ctype_base. + while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) + ++__i; + *__vec = static_cast<mask>(1 << __i); + } + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) + ++__low; + return __low; + } diff --git a/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ctype_noninline.h b/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ctype_noninline.h new file mode 100644 index 0000000..b22ad9a --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.6/bits/ctype_noninline.h @@ -0,0 +1,81 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(__trans_upper), _M_tolower(__trans_lower), + _M_table(__table ? __table : classic_table()) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(__trans_upper), _M_tolower(__trans_lower), + _M_table(__table ? __table : classic_table()) + { } + + char + ctype<char>::do_toupper(char __c) const + { return _M_toupper[static_cast<unsigned char>(__c)]; } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = _M_toupper[static_cast<unsigned char>(*__low)]; + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return _M_tolower[static_cast<unsigned char>(__c)]; } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = _M_tolower[static_cast<unsigned char>(*__low)]; + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/solaris/solaris2.6/bits/os_defines.h b/contrib/libstdc++/config/os/solaris/solaris2.6/bits/os_defines.h new file mode 100644 index 0000000..7aa9a7e --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.6/bits/os_defines.h @@ -0,0 +1,45 @@ +// Specific definitions for Solaris 2.6 -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +// These are typedefs which libio assumes are already in place (because +// they really are, under Linux). +#define __off_t off_t +#define __off64_t off64_t +#define __ssize_t ssize_t + +// Without this all the libio vtbls are offset wrongly. +#define _G_USING_THUNKS 0 + +#endif diff --git a/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ctype_base.h b/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ctype_base.h new file mode 100644 index 0000000..9b8bddc --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ctype_base.h @@ -0,0 +1,57 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h. Looks like this +// only works with solaris2.7 and solaris2.8. Thanks for not changing +// things, sun engineers! + + struct ctype_base + { + // Non-standard typedefs. + typedef int* __to_type; + + // NB: Offsets into ctype<char>::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned int mask; + static const mask upper = _ISUPPER; + static const mask lower = _ISLOWER; + static const mask alpha = _ISALPHA; + static const mask digit = _ISDIGIT; + static const mask xdigit = _ISXDIGIT; + static const mask space = _ISSPACE; + static const mask print = _ISPRINT; + static const mask graph = _ISGRAPH; + static const mask cntrl = _ISCNTRL; + static const mask punct = _ISPUNCT; + static const mask alnum = _ISALNUM; + }; diff --git a/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ctype_inline.h b/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ctype_inline.h new file mode 100644 index 0000000..af409c8 --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ctype_inline.h @@ -0,0 +1,69 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + + bool + ctype<char>:: + is(mask __m, char __c) const + { return _M_table[static_cast<unsigned char>(__c)] & __m; } + + const char* + ctype<char>:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; + return __high; + } + + const char* + ctype<char>:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) + ++__low; + return __low; + } + + const char* + ctype<char>:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) + ++__low; + return __low; + } diff --git a/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ctype_noninline.h b/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ctype_noninline.h new file mode 100644 index 0000000..c8b11a9 --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.7/bits/ctype_noninline.h @@ -0,0 +1,82 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return __ctype_mask; } + + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, + size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(__trans_upper), _M_tolower(__trans_lower), + _M_table(__table ? __table : classic_table()) + { } + + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(__trans_upper), _M_tolower(__trans_lower), + _M_table(__table ? __table : classic_table()) + { } + + char + ctype<char>::do_toupper(char __c) const + { return _M_toupper[static_cast<unsigned char>(__c)]; } + + const char* + ctype<char>::do_toupper(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = _M_toupper[static_cast<unsigned char>(*__low)]; + ++__low; + } + return __high; + } + + char + ctype<char>::do_tolower(char __c) const + { return _M_tolower[static_cast<unsigned char>(__c)]; } + + const char* + ctype<char>::do_tolower(char* __low, const char* __high) const + { + while (__low < __high) + { + *__low = _M_tolower[static_cast<unsigned char>(*__low)]; + ++__low; + } + return __high; + } diff --git a/contrib/libstdc++/config/os/solaris/solaris2.7/bits/os_defines.h b/contrib/libstdc++/config/os/solaris/solaris2.7/bits/os_defines.h new file mode 100644 index 0000000..356c55c --- /dev/null +++ b/contrib/libstdc++/config/os/solaris/solaris2.7/bits/os_defines.h @@ -0,0 +1,49 @@ +// Specific definitions for Solaris 7,8 -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_OS_DEFINES +#define _GLIBCPP_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +// These are typedefs which libio assumes are already in place (because +// they really are, under Linux). +#define __off_t off_t +#define __off64_t off64_t +#define __ssize_t ssize_t + +// Without this all the libio vtbls are offset wrongly. +#define _G_USING_THUNKS 0 + +#if defined(__sparcv9) || defined(__arch64__) +#define __glibcpp_long_bits 64 +#endif + +#endif |