OSDN Git Service

2003-01-22 Benjamin Kosnik <bkoz@redhat.com>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Jan 2003 16:51:52 +0000 (16:51 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Jan 2003 16:51:52 +0000 (16:51 +0000)
* include/bits/locale_facets.h: Move non-facet classes requiring
<string> to...
* include/bits/locale_classes.h: New.
* include/bits/Makefile.am (bits_headers_src): Add locale_classes.h.
* include/bits/Makefile.in: Regenerate.

* include/bits/locale_facets.tcc (__convert_from_v): Move to...
* config/locale/gnu/c_locale.h: ...here.
* config/locale/generic/c_locale.h: Same.

* include/bits/locale_facets.tcc: Move declarations to...
* include/bits/locale_facets.h: ...here.
* include/bits/basic_ios.h: Tweak includes accordingly.
* include/std/std_sstream.h: Add streambuf include.
* include/std/std_fstream.h: Ditto.
* include/std/std_locale.h: Add locale_classes.h include.
* include/std/std_iosfwd.h: Tweak.
* src/concept-inst.cc: Add iterator include.

* config/linker-map.gnu: Specify __cxa functions, mark __cxa_dyn_*
bits as unexported in the future.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61593 138bc75d-0d04-0410-961f-82ee72b054a4

18 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/config/linker-map.gnu
libstdc++-v3/config/locale/generic/c_locale.h
libstdc++-v3/config/locale/gnu/c_locale.cc
libstdc++-v3/config/locale/gnu/c_locale.h
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/basic_ios.h
libstdc++-v3/include/bits/ios_base.h
libstdc++-v3/include/bits/locale_classes.h [new file with mode: 0644]
libstdc++-v3/include/bits/locale_facets.h
libstdc++-v3/include/bits/locale_facets.tcc
libstdc++-v3/include/bits/localefwd.h
libstdc++-v3/include/std/std_fstream.h
libstdc++-v3/include/std/std_iosfwd.h
libstdc++-v3/include/std/std_locale.h
libstdc++-v3/include/std/std_sstream.h
libstdc++-v3/src/concept-inst.cc

index 091a336..fb4d7e2 100644 (file)
@@ -1,3 +1,27 @@
+2003-01-22  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * include/bits/locale_facets.h: Move non-facet classes requiring
+       <string> to...  
+       * include/bits/locale_classes.h: New.  
+       * include/bits/Makefile.am (bits_headers_src): Add locale_classes.h.
+       * include/bits/Makefile.in: Regenerate.
+
+       * include/bits/locale_facets.tcc (__convert_from_v): Move to...
+       * config/locale/gnu/c_locale.h: ...here.
+       * config/locale/generic/c_locale.h: Same.
+       
+       * include/bits/locale_facets.tcc: Move declarations to...
+       * include/bits/locale_facets.h: ...here.
+       * include/bits/basic_ios.h: Tweak includes accordingly.
+       * include/std/std_sstream.h: Add streambuf include.
+       * include/std/std_fstream.h: Ditto.
+       * include/std/std_locale.h: Add locale_classes.h include.
+       * include/std/std_iosfwd.h: Tweak.
+       * src/concept-inst.cc: Add iterator include.
+
+       * config/linker-map.gnu: Specify __cxa functions, mark __cxa_dyn_*
+       bits as unexported in the future.
+       
 2003-01-21  Benjamin Kosnik  <bkoz@redhat.com>
 
        Reshuffle 22_locale testsuite.
index 3aec49b..8f48c9f 100644 (file)
@@ -268,24 +268,6 @@ CXXABI_1.2 {
     __cxa_call_unexpected;
     __cxa_current_exception_type;
     __cxa_demangle;
-    __cxa_dyn_string_append_char;
-    __cxa_dyn_string_append_cstr;
-    __cxa_dyn_string_append;
-    __cxa_dyn_string_clear;
-    __cxa_dyn_string_copy_cstr;
-    __cxa_dyn_string_copy;
-    __cxa_dyn_string_delete;
-    __cxa_dyn_string_eq;
-    __cxa_dyn_string_init;
-    __cxa_dyn_string_insert_char;
-    __cxa_dyn_string_insert_cstr;
-    __cxa_dyn_string_insert;
-    __cxa_dyn_string_new;
-    __cxa_dyn_string_prepend_cstr;
-    __cxa_dyn_string_prepend;
-    __cxa_dyn_string_release;
-    __cxa_dyn_string_resize;
-    __cxa_dyn_string_substring;
     __cxa_end_catch;
     __cxa_free_exception;
     __cxa_get_globals;
@@ -310,6 +292,26 @@ CXXABI_1.2 {
     # __gnu_cxx::_verbose_terminate_handler()
     _ZN9__gnu_cxx27__verbose_terminate_handlerEv;
 
+    # XXX Should not be exported.
+    __cxa_dyn_string_append_char;
+    __cxa_dyn_string_append_cstr;
+    __cxa_dyn_string_append;
+    __cxa_dyn_string_clear;
+    __cxa_dyn_string_copy_cstr;
+    __cxa_dyn_string_copy;
+    __cxa_dyn_string_delete;
+    __cxa_dyn_string_eq;
+    __cxa_dyn_string_init;
+    __cxa_dyn_string_insert_char;
+    __cxa_dyn_string_insert_cstr;
+    __cxa_dyn_string_insert;
+    __cxa_dyn_string_new;
+    __cxa_dyn_string_prepend_cstr;
+    __cxa_dyn_string_prepend;
+    __cxa_dyn_string_release;
+    __cxa_dyn_string_resize;
+    __cxa_dyn_string_substring;
+
   local:
     *;
 };
index 9627d86..1947002 100644 (file)
@@ -1,6 +1,6 @@
 // Wrapper for underlying C-language localization -*- C++ -*-
 
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 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
@@ -41,6 +41,10 @@ namespace std
 {
   typedef int*                 __c_locale;
 
+  // Convert numeric value of type _Tv to string and return length of
+  // string.  If snprintf is available use it, otherwise fall back to
+  // the unsafe sprintf which, in general, can be dangerous and should
+  // be avoided.
   template<typename _Tv>
     int
     __convert_from_v(char* __out, const int __size, const char* __fmt,
index e816983..065e10a 100644 (file)
@@ -1,6 +1,6 @@
 // Wrapper for underlying C-language localization -*- C++ -*-
 
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 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
index 130b843..c7d8e6e 100644 (file)
@@ -1,6 +1,6 @@
 // Wrapper for underlying C-language localization -*- C++ -*-
 
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 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
@@ -53,6 +53,10 @@ namespace std
 {
   typedef __locale_t           __c_locale;
 
+  // Convert numeric value of type _Tv to string and return length of
+  // string.  If snprintf is available use it, otherwise fall back to
+  // the unsafe sprintf which, in general, can be dangerous and should
+  // be avoided.
   template<typename _Tv>
     int
     __convert_from_v(char* __out, const int __size, const char* __fmt,
index dc8da55..00e12a0 100644 (file)
@@ -53,6 +53,7 @@ bits_headers = \
        ${bits_srcdir}/ios_base.h \
        ${bits_srcdir}/istream.tcc \
        ${bits_srcdir}/list.tcc \
+       ${bits_srcdir}/locale_classes.h \
        ${bits_srcdir}/locale_facets.h \
        ${bits_srcdir}/locale_facets.tcc \
        ${bits_srcdir}/localefwd.h \
index 4c0ffdd..e39dffd 100644 (file)
@@ -171,6 +171,7 @@ bits_headers = \
        ${bits_srcdir}/ios_base.h \
        ${bits_srcdir}/istream.tcc \
        ${bits_srcdir}/list.tcc \
+       ${bits_srcdir}/locale_classes.h \
        ${bits_srcdir}/locale_facets.h \
        ${bits_srcdir}/locale_facets.tcc \
        ${bits_srcdir}/localefwd.h \
index 7acf678..29c1436 100644 (file)
@@ -38,6 +38,8 @@
 #pragma GCC system_header
 
 #include <bits/streambuf_iterator.h>
+#include <bits/localefwd.h>
+#include <bits/locale_classes.h>
 #include <bits/locale_facets.h>
 
 namespace std 
index 1f085d9..bdcb2b6 100644 (file)
@@ -43,6 +43,8 @@
 #pragma GCC system_header
 
 #include <bits/atomicity.h>
+#include <bits/localefwd.h>
+#include <bits/locale_classes.h>
 
 namespace std
 {
diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
new file mode 100644 (file)
index 0000000..fd4fc2d
--- /dev/null
@@ -0,0 +1,375 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// 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
+//
+
+/** @file localefwd.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#ifndef _CPP_BITS_LOCALE_CLASSES_H
+#define _CPP_BITS_LOCALE_CLASSES_H     1
+
+#pragma GCC system_header
+
+#include <bits/localefwd.h>
+#include <cctype>              // For isspace, etc.
+#include <cstring>             // For strcmp.
+#include <string>
+#include <bits/atomicity.h>
+
+namespace std
+{
+  // 22.1.1 Class locale
+  class locale
+  {
+  public:
+    // Types:
+    typedef unsigned int       category;
+
+    // Forward decls and friends:
+    class facet;
+    class id;
+    class _Impl;
+
+    friend class facet;
+    friend class _Impl;
+
+    template<typename _Facet>
+      friend const _Facet& 
+      use_facet(const locale&);
+    
+    template<typename _Facet>
+      friend bool 
+      has_facet(const locale&) throw();
+    // Category values:
+    // NB: Order must match _S_facet_categories definition in locale.cc
+    static const category none         = 0;
+    static const category ctype        = 1L << 0;
+    static const category numeric      = 1L << 1;
+    static const category collate      = 1L << 2;
+    static const category time                 = 1L << 3;
+    static const category monetary     = 1L << 4;
+    static const category messages     = 1L << 5;
+    static const category all          = (ctype | numeric | collate |
+                                          time  | monetary | messages);
+
+    // Construct/copy/destroy:
+    locale() throw();
+
+    locale(const locale& __other) throw();
+
+    explicit  
+    locale(const char* __s);
+
+    locale(const locale& __base, const char* __s, category __cat);
+
+    locale(const locale& __base, const locale& __add, category __cat);
+
+    template<typename _Facet>
+      locale(const locale& __other, _Facet* __f);
+
+    ~locale() throw();
+
+    const locale&  
+    operator=(const locale& __other) throw();
+
+    template<typename _Facet>
+      locale  
+      combine(const locale& __other) const;
+
+    // Locale operations:
+    string 
+    name() const;
+
+    bool 
+    operator==(const locale& __other) const throw ();
+
+    inline bool  
+    operator!=(const locale& __other) const throw ()
+    { return !(this->operator==(__other));  }
+
+    template<typename _Char, typename _Traits, typename _Alloc>
+      bool  
+      operator()(const basic_string<_Char, _Traits, _Alloc>& __s1,
+                const basic_string<_Char, _Traits, _Alloc>& __s2) const;
+
+    // Global locale objects:
+    static locale 
+    global(const locale&);
+
+    static const locale& 
+    classic();
+
+  private:
+    // The (shared) implementation
+    _Impl*             _M_impl;  
+
+    // The "C" reference locale
+    static _Impl*      _S_classic; 
+
+    // Current global locale
+    static _Impl*      _S_global;  
+
+    // Number of standard categories. For C++, these categories are
+    // collate, ctype, monetary, numeric, time, and messages. These
+    // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE,
+    // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE
+    // 1003.1-2001) specifies LC_MESSAGES.
+    static const size_t        _S_categories_size = 6;
+
+    // In addition to the standard categories, the underlying
+    // operating system is allowed to define extra LC_*
+    // macros. For GNU systems, the following are also valid:
+    // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT,
+    // and LC_IDENTIFICATION.
+    static const size_t        _S_extra_categories_size = _GLIBCPP_NUM_CATEGORIES;
+
+    // Names of underlying locale categories.  
+    // NB: locale::global() has to know how to modify all the
+    // underlying categories, not just the ones required by the C++
+    // standard.
+    static const char*         _S_categories[_S_categories_size 
+                                     + _S_extra_categories_size];
+
+    explicit 
+    locale(_Impl*) throw();
+
+    static inline void  
+    _S_initialize()
+    { 
+      if (!_S_classic) 
+       classic();  
+    }
+
+    static category  
+    _S_normalize_category(category);
+
+    void
+    _M_coalesce(const locale& __base, const locale& __add, category __cat);
+  };
+
+
+  // Implementation object for locale 
+  class locale::_Impl
+  {
+  public:
+    // Friends.
+    friend class locale;
+    friend class locale::facet;
+
+    template<typename _Facet>
+      friend const _Facet&  
+      use_facet(const locale&);
+
+    template<typename _Facet>
+      friend bool  
+      has_facet(const locale&) throw();
+
+  private:
+    // Data Members.
+    _Atomic_word                       _M_references;
+    facet**                            _M_facets;
+    size_t                             _M_facets_size;
+
+    char*                              _M_names[_S_categories_size
+                                                + _S_extra_categories_size];
+    static const locale::id* const     _S_id_ctype[];
+    static const locale::id* const     _S_id_numeric[];
+    static const locale::id* const     _S_id_collate[];
+    static const locale::id* const     _S_id_time[];
+    static const locale::id* const     _S_id_monetary[];
+    static const locale::id* const     _S_id_messages[];
+    static const locale::id* const* const _S_facet_categories[];
+
+    inline void 
+    _M_add_reference() throw()
+    { __atomic_add(&_M_references, 1); }
+
+    inline void 
+    _M_remove_reference() throw()
+    {
+      if (__exchange_and_add(&_M_references, -1) == 1)
+       {
+         try 
+           { delete this; } 
+         catch(...) 
+           { }
+       }
+    }
+
+    _Impl(const _Impl&, size_t);
+    _Impl(const char*, size_t);
+    _Impl(facet**, size_t, bool);
+
+   ~_Impl() throw();
+
+    _Impl(const _Impl&);  // Not defined.
+
+    void 
+    operator=(const _Impl&);  // Not defined.
+
+    inline bool
+    _M_check_same_name()
+    {
+      bool __ret = true;
+      for (size_t __i = 0; 
+          __ret && __i < _S_categories_size + _S_extra_categories_size - 1; 
+          ++__i)
+       __ret &= (strcmp(_M_names[__i], _M_names[__i + 1]) == 0);
+      return __ret;
+    }
+
+    void 
+    _M_replace_categories(const _Impl*, category);
+
+    void 
+    _M_replace_category(const _Impl*, const locale::id* const*);
+
+    void 
+    _M_replace_facet(const _Impl*, const locale::id*);
+
+    void 
+    _M_install_facet(const locale::id*, facet*);
+
+    template<typename _Facet>
+      inline void 
+      _M_init_facet(_Facet* __facet)
+      { _M_install_facet(&_Facet::id, __facet);  }
+  };
+
+  template<typename _Facet>
+    locale::locale(const locale& __other, _Facet* __f)
+    {
+      _M_impl = new _Impl(*__other._M_impl, 1);
+      _M_impl->_M_install_facet(&_Facet::id, __f);
+      for (size_t __i = 0; 
+          __i < _S_categories_size + _S_extra_categories_size; ++__i)
+       {
+         delete [] _M_impl->_M_names[__i];
+         char* __new = new char[2];
+         strcpy(__new, "*");
+         _M_impl->_M_names[__i] = __new;
+       }
+    }
+
+
+  // 22.1.1.1.2  Class locale::facet
+  class locale::facet
+  {
+  private:
+    friend class locale;
+    friend class locale::_Impl;
+
+    _Atomic_word                       _M_references;
+
+  protected:
+    // Contains data from the underlying "C" library for the classic locale.
+    static __c_locale                  _S_c_locale;
+
+    // String literal for the name of the classic locale.
+    static char                                _S_c_name[2];
+    
+    explicit 
+    facet(size_t __refs = 0) throw();
+
+    virtual 
+    ~facet();
+
+    static void
+    _S_create_c_locale(__c_locale& __cloc, const char* __s, 
+                      __c_locale __old = 0);
+
+    static __c_locale
+    _S_clone_c_locale(__c_locale& __cloc);
+
+    static void
+    _S_destroy_c_locale(__c_locale& __cloc);
+
+  private:
+    void 
+    _M_add_reference() throw();
+
+    void 
+    _M_remove_reference() throw();
+
+    facet(const facet&);  // Not defined.
+
+    void 
+    operator=(const facet&);  // Not defined.
+  };
+
+
+  // 22.1.1.1.3 Class locale::id
+  class locale::id
+  {
+  private:
+    friend class locale;
+    friend class locale::_Impl;
+    template<typename _Facet>
+      friend const _Facet&  
+      use_facet(const locale&);
+    template<typename _Facet>
+      friend bool           
+      has_facet(const locale&) throw ();
+
+    // NB: There is no accessor for _M_index because it may be used
+    // before the constructor is run; the effect of calling a member
+    // function (even an inline) would be undefined.
+    mutable size_t             _M_index;
+
+    // Last id number assigned.
+    static _Atomic_word        _S_highwater;   
+
+    void 
+    operator=(const id&);  // Not defined.
+
+    id(const id&);  // Not defined.
+
+  public:
+    // NB: This class is always a static data member, and thus can be
+    // counted on to be zero-initialized.
+    id();
+
+    inline size_t
+    _M_id() const
+    {
+      if (!_M_index)
+       _M_index = 1 + __exchange_and_add(&_S_highwater, 1);
+      return _M_index - 1;
+    }
+  };
+} // namespace std
+
+#endif
index 809155f..de9cef6 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -44,7 +44,9 @@
 
 #include <ctime>       // For struct tm
 #include <cwctype>     // For wctype_t
-#include <ios>         // For ios_base
+#include <iosfwd>
+#include <bits/ios_base.h>  // For ios_base, ios_base::iostate
+#include <streambuf>
 
 namespace std
 {
@@ -55,8 +57,72 @@ namespace std
 # define  _GLIBCPP_NUM_FACETS 14
 #endif
 
+  // Convert string to numeric value of type _Tv and store results.  
+  // NB: This is specialized for all required types, there is no
+  // generic definition.
+  template<typename _Tv>
+    void
+    __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err, 
+                  const __c_locale& __cloc, int __base = 10);
+
+  // Explicit specializations for required types.
+  template<>
+    void
+    __convert_to_v(const char*, long&, ios_base::iostate&, 
+                  const __c_locale&, int);
+
+  template<>
+    void
+    __convert_to_v(const char*, unsigned long&, ios_base::iostate&, 
+                  const __c_locale&, int);
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+  template<>
+    void
+    __convert_to_v(const char*, long long&, ios_base::iostate&, 
+                  const __c_locale&, int);
+
+  template<>
+    void
+    __convert_to_v(const char*, unsigned long long&, ios_base::iostate&, 
+                  const __c_locale&, int);
+#endif
+
+  template<>
+    void
+    __convert_to_v(const char*, float&, ios_base::iostate&, 
+                  const __c_locale&, int);
+
+  template<>
+    void
+    __convert_to_v(const char*, double&, ios_base::iostate&, 
+                  const __c_locale&, int);
+
+ template<>
+    void
+    __convert_to_v(const char*, long double&, ios_base::iostate&, 
+                  const __c_locale&, int);
+
+
   template<typename _CharT, typename _Traits>
-    struct __pad;
+    struct __pad
+    {
+      static void
+      _S_pad(ios_base& __io, _CharT __fill, _CharT* __news, 
+            const _CharT* __olds, const streamsize __newlen, 
+            const streamsize __oldlen, const bool __num);
+    };
+
+  template<typename _CharT>
+    bool
+    __verify_grouping(const basic_string<_CharT>& __grouping, 
+                     basic_string<_CharT>& __grouping_tmp);
+
+  template<typename _CharT>
+    _CharT*
+    __add_grouping(_CharT* __s, _CharT __sep,  
+                  const char* __gbeg, const char* __gend, 
+                  const _CharT* __first, const _CharT* __last);
 
   // 22.2.1.1  Template class ctype
   // Include host and configuration specific ctype enums for ctype_base.
index 26915e7..20c7575 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 #pragma GCC system_header
 
 #include <cerrno>
-#include <clocale>   // For localeconv
-#include <cstdlib>   // For strof, strtold
-#include <cmath>     // For ceil
-#include <cctype>    // For isspace
-#include <limits>    // For numeric_limits
+#include <clocale>             // For localeconv
+#include <cstdlib>             // For strof, strtold
+#include <cmath>               // For ceil
+#include <cctype>              // For isspace
+#include <limits>              // For numeric_limits
+#include <typeinfo>            // For bad_cast.
 #include <bits/streambuf_iterator.h>
-#include <typeinfo>  // For bad_cast.
 
 namespace std
 {
@@ -1965,22 +1965,6 @@ namespace std
       return static_cast<long>(__val);
     }
 
-  // Convert string to numeric value of type _Tv and store results.  
-  // NB: This is specialized for all required types, there is no
-  // generic definition.
-  template<typename _Tv>
-    void
-    __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err, 
-                  const __c_locale& __cloc, int __base = 10);
-
-  // Convert numeric value of type _Tv to string and return length of string.
-  // If snprintf is available use it, otherwise fall back to the unsafe sprintf
-  // which, in general, can be dangerous and should be avoided.
-  template<typename _Tv>
-    int
-    __convert_from_v(char* __out, const int __size, const char* __fmt,
-                    _Tv __v, const __c_locale&, int __prec = -1);
-
   // Construct correctly padded string, as per 22.2.2.2.2
   // Assumes 
   // __newlen > __oldlen
@@ -1993,15 +1977,6 @@ namespace std
   // NB: Of the two parameters, _CharT can be deduced from the
   // function arguments. The other (_Traits) has to be explicitly specified.
   template<typename _CharT, typename _Traits>
-    struct __pad
-    {
-      static void
-      _S_pad(ios_base& __io, _CharT __fill, _CharT* __news, 
-            const _CharT* __olds, const streamsize __newlen, 
-            const streamsize __oldlen, const bool __num);
-    };
-
-  template<typename _CharT, typename _Traits>
     void 
     __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill, 
                                   _CharT* __news, const _CharT* __olds, 
index 8000394..ac9e1a9 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
  *  You should not attempt to use it directly.
  */
 
-#ifndef _CPP_BITS_LOCCORE_H
-#define _CPP_BITS_LOCCORE_H    1
+#ifndef _CPP_BITS_LOCALE_FWD_H
+#define _CPP_BITS_LOCALE_FWD_H 1
 
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <bits/c++locale.h>     // Defines __c_locale, config-specific includes
-#include <climits>             // For CHAR_BIT
-#include <cctype>              // For isspace, etc.
-#include <string>              // For string.
+#include <iosfwd>              // For ostreambuf_iterator, istreambuf_iterator
 #include <bits/functexcept.h>
-#include <bits/atomicity.h>
 
 namespace std
 {
@@ -108,7 +105,6 @@ namespace std
     inline _CharT 
     tolower(_CharT, const locale&);
 
-
   // 22.2.1 and 22.2.1.3 ctype
   class ctype_base;
   template<typename _CharT> 
@@ -175,326 +171,6 @@ namespace std
   template<typename _CharT> 
     class messages_byname;
 
-  // 22.1.1 Class locale
-  class locale
-  {
-  public:
-    // Types:
-    typedef unsigned int       category;
-
-    // Forward decls and friends:
-    class facet;
-    class id;
-    class _Impl;
-
-    friend class facet;
-    friend class _Impl;
-
-    template<typename _Facet>
-      friend const _Facet& 
-      use_facet(const locale&);
-    
-    template<typename _Facet>
-      friend bool 
-      has_facet(const locale&) throw();
-    // Category values:
-    // NB: Order must match _S_facet_categories definition in locale.cc
-    static const category none         = 0;
-    static const category ctype        = 1L << 0;
-    static const category numeric      = 1L << 1;
-    static const category collate      = 1L << 2;
-    static const category time                 = 1L << 3;
-    static const category monetary     = 1L << 4;
-    static const category messages     = 1L << 5;
-    static const category all          = (ctype | numeric | collate |
-                                          time  | monetary | messages);
-
-    // Construct/copy/destroy:
-    locale() throw();
-
-    locale(const locale& __other) throw();
-
-    explicit  
-    locale(const char* __s);
-
-    locale(const locale& __base, const char* __s, category __cat);
-
-    locale(const locale& __base, const locale& __add, category __cat);
-
-    template<typename _Facet>
-      locale(const locale& __other, _Facet* __f);
-
-    ~locale() throw();
-
-    const locale&  
-    operator=(const locale& __other) throw();
-
-    template<typename _Facet>
-      locale  
-      combine(const locale& __other) const;
-
-    // Locale operations:
-    string 
-    name() const;
-
-    bool 
-    operator==(const locale& __other) const throw ();
-
-    inline bool  
-    operator!=(const locale& __other) const throw ()
-    { return !(this->operator==(__other));  }
-
-    template<typename _Char, typename _Traits, typename _Alloc>
-      bool  
-      operator()(const basic_string<_Char, _Traits, _Alloc>& __s1,
-                const basic_string<_Char, _Traits, _Alloc>& __s2) const;
-
-    // Global locale objects:
-    static locale 
-    global(const locale&);
-
-    static const locale& 
-    classic();
-
-  private:
-    // The (shared) implementation
-    _Impl*             _M_impl;  
-
-    // The "C" reference locale
-    static _Impl*      _S_classic; 
-
-    // Current global locale
-    static _Impl*      _S_global;  
-
-    // Number of standard categories. For C++, these categories are
-    // collate, ctype, monetary, numeric, time, and messages. These
-    // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE,
-    // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE
-    // 1003.1-2001) specifies LC_MESSAGES.
-    static const size_t        _S_categories_size = 6;
-
-    // In addition to the standard categories, the underlying
-    // operating system is allowed to define extra LC_*
-    // macros. For GNU systems, the following are also valid:
-    // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT,
-    // and LC_IDENTIFICATION.
-    static const size_t        _S_extra_categories_size = _GLIBCPP_NUM_CATEGORIES;
-
-    // Names of underlying locale categories.  
-    // NB: locale::global() has to know how to modify all the
-    // underlying categories, not just the ones required by the C++
-    // standard.
-    static const char*         _S_categories[_S_categories_size 
-                                     + _S_extra_categories_size];
-
-    explicit 
-    locale(_Impl*) throw();
-
-    static inline void  
-    _S_initialize()
-    { 
-      if (!_S_classic) 
-       classic();  
-    }
-
-    static category  
-    _S_normalize_category(category);
-
-    void
-    _M_coalesce(const locale& __base, const locale& __add, category __cat);
-  };
-
-
-  // Implementation object for locale 
-  class locale::_Impl
-  {
-  public:
-    // Friends.
-    friend class locale;
-    friend class locale::facet;
-
-    template<typename _Facet>
-      friend const _Facet&  
-      use_facet(const locale&);
-
-    template<typename _Facet>
-      friend bool  
-      has_facet(const locale&) throw();
-
-  private:
-    // Data Members.
-    _Atomic_word                       _M_references;
-    facet**                            _M_facets;
-    size_t                             _M_facets_size;
-
-    char*                              _M_names[_S_categories_size
-                                                + _S_extra_categories_size];
-    static const locale::id* const     _S_id_ctype[];
-    static const locale::id* const     _S_id_numeric[];
-    static const locale::id* const     _S_id_collate[];
-    static const locale::id* const     _S_id_time[];
-    static const locale::id* const     _S_id_monetary[];
-    static const locale::id* const     _S_id_messages[];
-    static const locale::id* const* const _S_facet_categories[];
-
-    inline void 
-    _M_add_reference() throw()
-    { __atomic_add(&_M_references, 1); }
-
-    inline void 
-    _M_remove_reference() throw()
-    {
-      if (__exchange_and_add(&_M_references, -1) == 1)
-       {
-         try 
-           { delete this; } 
-         catch(...) 
-           { }
-       }
-    }
-
-    _Impl(const _Impl&, size_t);
-    _Impl(const char*, size_t);
-    _Impl(facet**, size_t, bool);
-
-   ~_Impl() throw();
-
-    _Impl(const _Impl&);  // Not defined.
-
-    void 
-    operator=(const _Impl&);  // Not defined.
-
-    inline bool
-    _M_check_same_name()
-    {
-      bool __ret = true;
-      for (size_t __i = 0; 
-          __ret && __i < _S_categories_size + _S_extra_categories_size - 1; 
-          ++__i)
-       __ret &= (strcmp(_M_names[__i], _M_names[__i + 1]) == 0);
-      return __ret;
-    }
-
-    void 
-    _M_replace_categories(const _Impl*, category);
-
-    void 
-    _M_replace_category(const _Impl*, const locale::id* const*);
-
-    void 
-    _M_replace_facet(const _Impl*, const locale::id*);
-
-    void 
-    _M_install_facet(const locale::id*, facet*);
-
-    template<typename _Facet>
-      inline void 
-      _M_init_facet(_Facet* __facet)
-      { _M_install_facet(&_Facet::id, __facet);  }
-  };
-
-  template<typename _Facet>
-    locale::locale(const locale& __other, _Facet* __f)
-    {
-      _M_impl = new _Impl(*__other._M_impl, 1);
-      _M_impl->_M_install_facet(&_Facet::id, __f);
-      for (size_t __i = 0; 
-          __i < _S_categories_size + _S_extra_categories_size; ++__i)
-       {
-         delete [] _M_impl->_M_names[__i];
-         char* __new = new char[2];
-         strcpy(__new, "*");
-         _M_impl->_M_names[__i] = __new;
-       }
-    }
-
-  // 22.1.1.1.2  Class locale::facet
-  class locale::facet
-  {
-  private:
-    friend class locale;
-    friend class locale::_Impl;
-
-    _Atomic_word                       _M_references;
-
-  protected:
-    // Contains data from the underlying "C" library for the classic locale.
-    static __c_locale                  _S_c_locale;
-
-    // String literal for the name of the classic locale.
-    static char                                _S_c_name[2];
-    
-    explicit 
-    facet(size_t __refs = 0) throw();
-
-    virtual 
-    ~facet();
-
-    static void
-    _S_create_c_locale(__c_locale& __cloc, const char* __s, 
-                      __c_locale __old = 0);
-
-    static __c_locale
-    _S_clone_c_locale(__c_locale& __cloc);
-
-    static void
-    _S_destroy_c_locale(__c_locale& __cloc);
-
-  private:
-    void 
-    _M_add_reference() throw();
-
-    void 
-    _M_remove_reference() throw();
-
-    facet(const facet&);  // Not defined.
-
-    void 
-    operator=(const facet&);  // Not defined.
-  };
-
-
-  // 22.1.1.1.3 Class locale::id
-  class locale::id
-  {
-  private:
-    friend class locale;
-    friend class locale::_Impl;
-    template<typename _Facet>
-      friend const _Facet&  
-      use_facet(const locale&);
-    template<typename _Facet>
-      friend bool           
-      has_facet(const locale&) throw ();
-
-    // NB: There is no accessor for _M_index because it may be used
-    // before the constructor is run; the effect of calling a member
-    // function (even an inline) would be undefined.
-    mutable size_t             _M_index;
-
-    // Last id number assigned.
-    static _Atomic_word        _S_highwater;   
-
-    void 
-    operator=(const id&);  // Not defined.
-
-    id(const id&);  // Not defined.
-
-  public:
-    // NB: This class is always a static data member, and thus can be
-    // counted on to be zero-initialized.
-    id();
-
-    inline size_t
-    _M_id() const
-    {
-      if (!_M_index)
-       _M_index = 1 + __exchange_and_add(&_S_highwater, 1);
-      return _M_index - 1;
-    }
-  };
-
   template<typename _Facet>
     const _Facet&
     use_facet(const locale& __loc);
index 0c7bf18..d2ddd04 100644 (file)
@@ -42,6 +42,7 @@
 
 #pragma GCC system_header
 
+#include <streambuf>
 #include <istream>
 #include <ostream>
 #include <locale>      // For codecvt
index 124c8ff..4016047 100644 (file)
@@ -1,6 +1,7 @@
 // Forwarding declarations -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003
+// 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
@@ -42,7 +43,7 @@
 #pragma GCC system_header
 
 #include <bits/c++config.h>
-#include <bits/stringfwd.h> // For string forward declarations.
+#include <bits/stringfwd.h>    // For string forward declarations.
 #include <bits/fpos.h>
 #include <bits/functexcept.h>
 
index 9c46b96..2960256 100644 (file)
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2002, 2003 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
 #pragma GCC system_header
 
 #include <bits/localefwd.h>
+#include <bits/locale_classes.h>
 #include <bits/locale_facets.h>
 #include <bits/locale_facets.tcc>
 
 #endif
-
-// Local Variables:
-// mode:c++
-// End:
index 0ad52d0..a6dda0b 100644 (file)
@@ -41,6 +41,7 @@
 
 #pragma GCC system_header
 
+#include <streambuf>
 #include <istream>
 #include <ostream>
 
index d0129e5..e173549 100644 (file)
@@ -1,6 +1,6 @@
 // Concept checking instantiations -*- C++ -*-
 
-// Copyright (C) 2001, 2002 Free Software Foundation
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation
 //
 // 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
@@ -39,6 +39,7 @@
 #ifdef _GLIBCPP_CONCEPT_CHECKS
 
 #include <memory>
+#include <iterator>
 #include <ostream>
 
 #define _Instantiate(...) template void __function_requires< __VA_ARGS__ > ()