This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[v3] static data member cleanup in locale



tested x86/linux with old and new abi

2000-12-22  Benjamin Kosnik  <bkoz@fillmore.redhat.com>

	Attempt to make locale visible in gdb.
	* include/bits/std_locale.h: Remove codecvt.h include.
	* include/bits/locale_facets.h: Add here, after ctype decls.
	* include/bits/codecvt.h: Remove std namespace, as assumed to be
	in std now.

	* include/bits/locale_facets.h: Consistently move generic static
	member definitions directly after generic facet declarations.
	* include/bits/locale_facets.tcc: From here.

	* src/locale.cc: Organize locale::id static definitions for
	required facets.
	* src/codecvt.cc (codecvt<char...>): Remove locale::id definition.
	(codecvt<wchar_t...>): Same.
	* src/localename: And here.
	
	* include/bits/localefwd.h (_Count_ones): Change _S_count to _M_count.
	Same for _M_halfcount.
	(std): make locale::_Impl protected. CHANGE BACK

Index: include/bits/codecvt.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/codecvt.h,v
retrieving revision 1.8
diff -c -p -r1.8 codecvt.h
*** codecvt.h	2000/12/07 06:44:48	1.8
--- codecvt.h	2000/12/22 10:59:51
***************
*** 38,51 ****
  #ifndef _CPP_BITS_CODECVT_H
  #define _CPP_BITS_CODECVT_H	1
  
- #include <bits/c++config.h>
- #ifdef _GLIBCPP_USE_WCHAR_T
- #include <iconv.h>		// For iconv, iconv_t
- #include <langinfo.h>
- #endif
- 
- namespace std
- {
    // XXX 
    // __enc_traits may need to move up the locale header hierarchy,
    // depending on if ctype ends up using it.
--- 38,43 ----
*************** namespace std
*** 714,720 ****
        virtual 
        ~codecvt_byname() { }
      };
- } // namespace std
  
  #endif // _CPP_BITS_CODECVT_H
  
--- 706,711 ----
Index: include/bits/locale_facets.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/locale_facets.h,v
retrieving revision 1.9
diff -c -p -r1.9 locale_facets.h
*** locale_facets.h	2000/12/14 09:07:01	1.9
--- locale_facets.h	2000/12/22 10:59:54
***************
*** 41,46 ****
--- 41,48 ----
  #include <bits/std_ios.h>	// For ios_base
  #ifdef _GLIBCPP_USE_WCHAR_T
  # include <bits/std_cwctype.h>	// For wctype_t
+ # include <iconv.h>		// For codecvt using iconv, iconv_t
+ # include <langinfo.h>		// For codecvt using nl_langinfo
  #endif 
  
  namespace std
*************** namespace std
*** 78,88 ****
      _Use_facet_failure_handler(const locale&)
      { throw _Bad_use_facet(); }
  
!   // 22.2.1  The ctype category
    // Include host-specific ctype enums for ctype_base.
    #include <bits/ctype_base.h>
  
-   // 22.2.1.1  Template class ctype
    // __ctype_abstract_base is the common base for ctype<_CharT>.  
    template<typename _CharT>
      class __ctype_abstract_base : public locale::facet, public ctype_base
--- 80,89 ----
      _Use_facet_failure_handler(const locale&)
      { throw _Bad_use_facet(); }
  
!   // 22.2.1.1  Template class ctype
    // Include host-specific ctype enums for ctype_base.
    #include <bits/ctype_base.h>
  
    // __ctype_abstract_base is the common base for ctype<_CharT>.  
    template<typename _CharT>
      class __ctype_abstract_base : public locale::facet, public ctype_base
*************** namespace std
*** 208,213 ****
--- 209,217 ----
        ~ctype() { }
      };
  
+   template<typename _CharT>
+     locale::id ctype<_CharT>::id;
+ 
    // 22.2.1.3  ctype specializations
    template<>
      class ctype<char> : public __ctype_abstract_base<char>
*************** namespace std
*** 395,400 ****
--- 399,407 ----
      ctype_byname<char>::ctype_byname(const char*, size_t refs);
  
  
+   // 22.2.1.5  Template class codecvt
+   #include <bits/codecvt.h>
+ 
    template<typename _CharT, typename _InIter>
      class _Numeric_get;  // forward
  
*************** namespace std
*** 495,500 ****
--- 502,514 ----
        _S_callback(ios_base::event __event, ios_base& __ios, int __ix) throw();
      };
  
+   template<typename _CharT>
+     int _Format_cache<_CharT>::_S_pword_ix;
+ 
+   template<typename _CharT>
+     const char _Format_cache<_CharT>::
+     _S_literals[] = "-+xX0123456789abcdef0123456789ABCDEF";
+ 
     template<> _Format_cache<char>::_Format_cache();
  #ifdef _GLIBCPP_USE_WCHAR_T
     template<> _Format_cache<wchar_t>::_Format_cache();
*************** namespace std
*** 679,684 ****
--- 693,701 ----
  	     void*&) const;
      };
  
+   template<typename _CharT, typename _InIter>
+     locale::id num_get<_CharT, _InIter>::id;
+ 
    // Declare specialized extraction member function.
    template<>
      void
*************** namespace std
*** 788,793 ****
--- 805,813 ----
        do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;
      };
  
+   template <typename _CharT, typename _OutIter>
+     locale::id num_put<_CharT, _OutIter>::id;
+ 
    template<typename _CharT>
      class _Punct : public locale::facet
      {
*************** namespace std
*** 841,847 ****
  	_M_thousands_sep = __t;
  	_M_grouping = __g;
        }
- 
      };
  
    template<typename _CharT>
--- 861,866 ----
*************** namespace std
*** 887,893 ****
  	_M_truename = __t;
  	_M_falsename = __f;
        }
- 	
      };
  
    template<typename _CharT>
--- 906,911 ----
*************** namespace std
*** 901,912 ****
  
        explicit 
        numpunct(size_t __refs = 0) : _Numpunct<_CharT>(__refs) { }
-     protected:
  
        virtual 
        ~numpunct() { }
      };
  
    template<> 
      numpunct<char>::numpunct(size_t __refs): _Numpunct<char>(__refs)
      {
--- 919,933 ----
  
        explicit 
        numpunct(size_t __refs = 0) : _Numpunct<_CharT>(__refs) { }
  
+     protected:
        virtual 
        ~numpunct() { }
      };
  
+   template<typename _CharT>
+     locale::id numpunct<_CharT>::id;
+ 
    template<> 
      numpunct<char>::numpunct(size_t __refs): _Numpunct<char>(__refs)
      {
*************** namespace std
*** 1001,1006 ****
--- 1022,1030 ----
        ~collate() { }
      };
  
+   template<typename _CharT>
+     locale::id collate<_CharT>::id;
+ 
    template<>
      class collate<char> : public _Collate<char>
      {
*************** namespace std
*** 1171,1176 ****
--- 1195,1203 ----
      };
  
    template<typename _CharT, typename _InIter>
+     locale::id time_get<_CharT, _InIter>::id;
+ 
+   template<typename _CharT, typename _InIter>
      class time_get_byname : public time_get<_CharT, _InIter>
      {
      public:
*************** namespace std
*** 1220,1225 ****
--- 1247,1255 ----
      };
  
    template<typename _CharT, typename _OutIter>
+     locale::id time_put<_CharT, _OutIter>::id;
+ 
+   template<typename _CharT, typename _OutIter>
      class time_put_byname : public time_put<_CharT, _OutIter>
      {
      public:
*************** namespace std
*** 1276,1281 ****
--- 1306,1314 ----
        { return __s; }
      };
  
+   template<typename _CharT, typename _InIter>
+     locale::id money_get<_CharT, _InIter>::id;
+ 
    template<typename _CharT, typename _OutIter>
      class money_put : public locale::facet
      {
*************** namespace std
*** 1314,1319 ****
--- 1347,1355 ----
        { return __s; }
      };
  
+   template<typename _CharT, typename _OutIter>
+     locale::id money_put<_CharT, _OutIter>::id;
+ 
    struct money_base
    {
      enum part { none, space, symbol, sign, value };
*************** namespace std
*** 1405,1410 ****
--- 1441,1452 ----
      };
  
    template<typename _CharT, bool _Intl>
+     locale::id moneypunct<_CharT, _Intl>::id;
+ 
+   template<typename _CharT, bool _Intl>
+     const bool moneypunct<_CharT, _Intl>::intl;
+ 
+   template<typename _CharT, bool _Intl>
      class moneypunct_byname : public moneypunct<_CharT,_Intl>
      {
      public:
*************** namespace std
*** 1420,1425 ****
--- 1462,1470 ----
        ~moneypunct_byname() { }
      };
  
+   template<typename _CharT, bool _Intl>
+     const bool moneypunct_byname<_CharT, _Intl>::intl;
+ 
    template<>
      moneypunct_byname<char, false>::
      moneypunct_byname(const char*, size_t __refs);
*************** namespace std
*** 1496,1501 ****
--- 1541,1549 ----
      };
  
    template<typename _CharT>
+     locale::id messages<_CharT>::id;
+ 
+   template<typename _CharT>
      class messages_byname : public messages<_CharT>
      {
      public:
*************** namespace std
*** 1584,1590 ****
      inline _CharT 
      tolower(_CharT __c, const locale& __loc)
      { return use_facet<ctype<_CharT> >(__loc).tolower(__c); }
- 
  } // namespace std
  
  #endif	/* _CPP_BITS_LOCFACETS_H */
--- 1632,1637 ----
*************** namespace std
*** 1592,1595 ****
  // Local Variables:
  // mode:c++
  // End:
- 
--- 1639,1641 ----
Index: include/bits/locale_facets.tcc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/locale_facets.tcc,v
retrieving revision 1.4
diff -c -p -r1.4 locale_facets.tcc
*** locale_facets.tcc	2000/11/17 05:38:04	1.4
--- locale_facets.tcc	2000/12/22 10:59:57
*************** namespace std
*** 159,174 ****
      }
  
    template<typename _CharT>
-     locale::id ctype<_CharT>::id;
- 
-   template<typename _CharT>
-     int _Format_cache<_CharT>::_S_pword_ix;
- 
-   template<typename _CharT>
-     const char _Format_cache<_CharT>::
-     _S_literals[] = "-+xX0123456789abcdef0123456789ABCDEF";
- 
-   template<typename _CharT>
      _Format_cache<_CharT>::_Format_cache()
      : _M_valid(true), _M_use_grouping(false)
      { }
--- 159,164 ----
*************** namespace std
*** 244,252 ****
        return __ncp;
      }
  
-   template<typename _CharT, typename _InIter>
-     locale::id num_get<_CharT, _InIter>::id;
- 
    // This member function takes an (w)istreambuf_iterator object and
    // parses it into a generic char array suitable for parsing with
    // strto[l,ll,f,d]. The thought was to encapsulate the conversion
--- 234,239 ----
*************** namespace std
*** 729,737 ****
        return __beg;
      }
  
-   template <typename _CharT, typename _OutIter>
-     locale::id num_put<_CharT, _OutIter>::id;
- 
    // _S_fill is specialized for ostreambuf_iterator, random access iterator.
    template <typename _CharT, typename _OutIter>
      inline _OutIter
--- 716,721 ----
*************** namespace std
*** 1119,1130 ****
        }
      }
  
-   template<typename _CharT>
-     locale::id numpunct<_CharT>::id;
- 
-   template<typename _CharT>
-     locale::id collate<_CharT>::id;
- 
    // Support for time_get:
    // Note that these partial specializations could, and maybe should,
    // be changed to full specializations (by eliminating the _Dummy
--- 1103,1108 ----
*************** namespace std
*** 1194,1202 ****
  #endif
  
    template<typename _CharT, typename _InIter>
-     locale::id time_get<_CharT, _InIter>::id;
- 
-   template<typename _CharT, typename _InIter>
      _InIter
      time_get<_CharT, _InIter>::
      do_get_weekday(iter_type __s, iter_type __end,
--- 1172,1177 ----
*************** namespace std
*** 1249,1275 ****
          __err |= __io.failbit;
        return __out;
      }
- 
-   template<typename _CharT, typename _OutIter>
-     locale::id time_put<_CharT, _OutIter>::id;
- 
-   template<typename _CharT, typename _InIter>
-     locale::id money_get<_CharT, _InIter>::id;
- 
-   template<typename _CharT, typename _OutIter>
-     locale::id money_put<_CharT, _OutIter>::id;
- 
-   template<typename _CharT, bool _Intl>
-     locale::id moneypunct<_CharT, _Intl>::id;
- 
-   template<typename _CharT, bool _Intl>
-     const bool moneypunct<_CharT, _Intl>::intl;
- 
-   template<typename _CharT, bool _Intl>
-     const bool moneypunct_byname<_CharT, _Intl>::intl;
- 
-   template<typename _CharT>
-     locale::id messages<_CharT>::id;
  } // std::
  
  #endif /* _CPP_BITS_LOCFACETS_TCC */
--- 1224,1229 ----
Index: include/bits/localefwd.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/localefwd.h,v
retrieving revision 1.5
diff -c -p -r1.5 localefwd.h
*** localefwd.h	2000/12/07 06:44:49	1.5
--- localefwd.h	2000/12/22 10:59:58
*************** namespace std
*** 56,62 ****
      {
        enum
        {
!         _S_count = _Num
        };
      };
  
--- 56,62 ----
      {
        enum
        {
!         _M_count = _Num
        };
      };
  
*************** namespace std
*** 65,73 ****
      {
        enum
        {
!         _S_halfcount = _Count_ones<_Num, _Shift/2,
!                                    (_Mask^((~_Mask)>>(_Shift/2))) >::_S_count,
!         _S_count = (_S_halfcount&_Mask) + ((_S_halfcount>>_Shift)&_Mask)
        };
      };
  
--- 65,73 ----
      {
        enum
        {
!         _M_halfcount = _Count_ones<_Num, _Shift/2,
!                                    (_Mask^((~_Mask)>>(_Shift/2))) >::_M_count,
!         _M_count = (_M_halfcount&_Mask) + ((_M_halfcount>>_Shift)&_Mask)
        };
      };
  
*************** namespace std
*** 138,144 ****
  #ifdef _GLIBCPP_USE_WCHAR_T
    template<> class ctype<wchar_t>;
  #endif
- 
    template<typename _CharT> 
      class ctype_byname;
    // NB: Specialized for char and wchar_t in locale_facets.h.
--- 138,143 ----
*************** namespace std
*** 150,156 ****
  #ifdef _GLIBCPP_USE_WCHAR_T
    template<> class codecvt<wchar_t, char, mbstate_t>;
  #endif
- 
    template<typename _InternT, typename _ExternT, typename _StateT>
      class codecvt_byname;
  
--- 149,154 ----
*************** namespace std
*** 207,213 ****
    {
    public:
      // Types:
!     typedef int category;
  
      // Forward decls and friends:
      class facet;
--- 205,211 ----
    {
    public:
      // Types:
!     typedef unsigned int category;
  
      // Forward decls and friends:
      class facet;
*************** namespace std
*** 227,238 ****
      // Category values:
      // NB much depends on the order in which these appear:
      static const category none		= 0;
!     static const category collate  	= 0x0100;
!     static const category ctype 	= 0x0200;
!     static const category monetary 	= 0x0400;
!     static const category numeric 	= 0x0800;
!     static const category time 		= 0x1000;
!     static const category messages 	= 0x2000;
      static const category all 		= (collate | ctype | monetary |
  				 	   numeric | time  | messages);
  
--- 225,236 ----
      // Category values:
      // NB much depends on the order in which these appear:
      static const category none		= 0;
!     static const category ctype 	= 1 << 0;
!     static const category numeric 	= 1 << 1;
!     static const category collate  	= 1 << 2;
!     static const category time 		= 1 << 3;
!     static const category monetary 	= 1 << 4;
!     static const category messages 	= 1 << 5;
      static const category all 		= (collate | ctype | monetary |
  				 	   numeric | time  | messages);
  
*************** namespace std
*** 296,302 ****
      // Current global reference locale
      static _Impl* 	_S_global;  
  
!     static const int 	_S_categories_num = _Count_ones<all>::_S_count;
      static const int 	_S_facets_num = 26;
  
      explicit 
--- 294,300 ----
      // Current global reference locale
      static _Impl* 	_S_global;  
  
!     static const int 	_S_categories_num = _Count_ones<all>::_M_count;
      static const int 	_S_facets_num = 26;
  
      explicit 
*************** namespace std
*** 331,348 ****
        friend bool  
        has_facet(const locale&) throw();
  
!   private:
      // Data Members.
      size_t 				_M_references;
      __vec_facet* 			_M_facets;
      __vec_string* 			_M_category_names;
      bool 				_M_has_name;
      string 				_M_name;
-     static const locale::id* const 	_S_id_collate[];
      static const locale::id* const 	_S_id_ctype[];
-     static const locale::id* const 	_S_id_monetary[];
      static const locale::id* const 	_S_id_numeric[];
      static const locale::id* const 	_S_id_time[];
      static const locale::id* const 	_S_id_messages[];
      static const locale::id* const* const _S_facet_categories[];
  
--- 329,347 ----
        friend bool  
        has_facet(const locale&) throw();
  
!     //  private:
!   protected:
      // Data Members.
      size_t 				_M_references;
      __vec_facet* 			_M_facets;
      __vec_string* 			_M_category_names;
      bool 				_M_has_name;
      string 				_M_name;
      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[];
  
*************** namespace std
*** 471,477 ****
        friend bool           
        has_facet(const locale&) throw ();
    public:
!     id() {};
    private:
      // NB: There is no accessor for _M_index because it may be used
      // before the constructor is run; the effect of calling a member
--- 470,476 ----
        friend bool           
        has_facet(const locale&) throw ();
    public:
!     id() { };
    private:
      // NB: There is no accessor for _M_index because it may be used
      // before the constructor is run; the effect of calling a member
Index: include/bits/std_locale.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/std_locale.h,v
retrieving revision 1.1
diff -c -p -r1.1 std_locale.h
*** std_locale.h	2000/10/05 11:27:01	1.1
--- std_locale.h	2000/12/22 10:59:58
***************
*** 37,43 ****
  #include <bits/localefwd.h>
  #include <bits/locale_facets.h>
  #include <bits/locale_facets.tcc>
- #include <bits/codecvt.h>
  
  #endif
  
--- 37,42 ----
Index: src/codecvt.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/codecvt.cc,v
retrieving revision 1.5
diff -c -p -r1.5 codecvt.cc
*** codecvt.cc	2000/12/07 06:44:49	1.5
--- codecvt.cc	2000/12/22 11:00:00
*************** namespace std {
*** 36,44 ****
    const int __enc_traits::_S_max_size;
  #endif /* _GLIBCPP_USE_WCHAR_T */
  
-   // codecvt<char, char, mbstate_t> required specialization
-   locale::id codecvt<char, char, mbstate_t>::id;
- 
    codecvt<char, char, mbstate_t>::
    codecvt(size_t __refs)
    : __codecvt_abstract_base<char, char, mbstate_t>(__refs)
--- 36,41 ----
*************** namespace std {
*** 107,114 ****
    
  #ifdef _GLIBCPP_USE_WCHAR_T
    // codecvt<wchar_t, char, mbstate_t> required specialization
-   locale::id codecvt<wchar_t, char, mbstate_t>::id;
- 
    codecvt<wchar_t, char, mbstate_t>::
    codecvt(size_t __refs)
    : __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs) { }
--- 104,109 ----
Index: src/locale.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/locale.cc,v
retrieving revision 1.23
diff -c -p -r1.23 locale.cc
*** locale.cc	2000/12/19 22:55:06	1.23
--- locale.cc	2000/12/22 11:00:02
***************
*** 41,55 ****
  # include <bits/std_cwctype.h>     // for towupper, etc.
  #endif
  
! namespace std {
! 
    // Definitions for static const data members of locale.
    const locale::category 	locale::none;
-   const locale::category 	locale::collate;
    const locale::category 	locale::ctype;
-   const locale::category 	locale::monetary;
    const locale::category 	locale::numeric;
    const locale::category 	locale::time;
    const locale::category 	locale::messages;
    const locale::category 	locale::all;
  
--- 41,55 ----
  # include <bits/std_cwctype.h>     // for towupper, etc.
  #endif
  
! namespace std 
! {
    // Definitions for static const data members of locale.
    const locale::category 	locale::none;
    const locale::category 	locale::ctype;
    const locale::category 	locale::numeric;
+   const locale::category 	locale::collate;
    const locale::category 	locale::time;
+   const locale::category 	locale::monetary;
    const locale::category 	locale::messages;
    const locale::category 	locale::all;
  
*************** namespace std {
*** 58,152 ****
    const int 			locale::_S_categories_num;
    const int 			locale::_S_facets_num;
  
!   // Definitions for static const data members of locale::_Impl
!   const locale::id* const
!   locale::_Impl::_S_id_collate[] =
!   {
!     &std::collate<char>::id,
! #ifdef _GLIBCPP_USE_WCHAR_T
!     &std::collate<wchar_t>::id,
  #endif
!     0
!   };
!   
    const locale::id* const
    locale::_Impl::_S_id_ctype[] =
    {
      &std::ctype<char>::id, 
- #ifdef _GLIBCPP_USE_WCHAR_T
-     &std::ctype<wchar_t>::id,
- #endif
      &codecvt<char, char, mbstate_t>::id,
  #ifdef _GLIBCPP_USE_WCHAR_T
      &codecvt<wchar_t, char, mbstate_t>::id,
  #endif
      0
    };
  
    const locale::id* const
!   locale::_Impl::_S_id_monetary[] =
    {
!     &moneypunct<char, false>::id, 
! #ifdef _GLIBCPP_USE_WCHAR_T
!     &moneypunct<wchar_t, false>::id,
! #endif
!     &std::moneypunct<char,true >::id, 
! #ifdef _GLIBCPP_USE_WCHAR_T
!     &moneypunct<wchar_t,true >::id,
! #endif
!     &money_get<char>::id,        
! #ifdef _GLIBCPP_USE_WCHAR_T
!     &money_get<wchar_t>::id,
! #endif
!     &money_put<char>::id,        
  #ifdef _GLIBCPP_USE_WCHAR_T
!     &money_put<wchar_t>::id,
  #endif
      0
    };
! 
    const locale::id* const
!   locale::_Impl::_S_id_numeric[] =
    {
!     &numpunct<char>::id, 
! #ifdef _GLIBCPP_USE_WCHAR_T
!     &numpunct<wchar_t>::id,
! #endif
!     &num_get<char>::id,  
!  #ifdef _GLIBCPP_USE_WCHAR_T
!     &num_get<wchar_t>::id,
! #endif
!     &num_put<char>::id,  
  #ifdef _GLIBCPP_USE_WCHAR_T
!     &num_put<wchar_t>::id,
  #endif
      0
    };
!   
    const locale::id* const
    locale::_Impl::_S_id_time[] =
    {
      &time_get<char>::id, 
- #ifdef _GLIBCPP_USE_WCHAR_T
-     &time_get<wchar_t>::id,
- #endif
      &time_put<char>::id, 
  #ifdef _GLIBCPP_USE_WCHAR_T
      &time_put<wchar_t>::id,
  #endif
      0
    };
    
    const locale::id* const
!   locale::_Impl::_S_id_messages[] =
    {
!     &time_get<char>::id, 
  #ifdef _GLIBCPP_USE_WCHAR_T
!     &time_get<wchar_t>::id,
  #endif
!     &time_put<char>::id, 
  #ifdef _GLIBCPP_USE_WCHAR_T
!     &time_put<wchar_t>::id,
  #endif
      0
    };
--- 58,168 ----
    const int 			locale::_S_categories_num;
    const int 			locale::_S_facets_num;
  
!   // Definitions for locale::id of standard facets. 
!   locale::id ctype<char>::id;
!   locale::id codecvt<char, char, mbstate_t>::id;
!   locale::id num_get<char>::id;
!   locale::id num_put<char>::id;
!   locale::id numpunct<char>::id;
!   locale::id collate<char>::id;
!   locale::id time_get<char>::id;
!   locale::id time_put<char>::id;
!   locale::id money_get<char>::id;
!   locale::id money_put<char>::id;
!   locale::id moneypunct<char, false>::id;
!   locale::id moneypunct<char, true>::id;
!   locale::id messages<char>::id;
! 
! #ifdef _GLIBCPP_USE_WCHAR_T  
!   locale::id ctype<wchar_t>::id;
!   locale::id codecvt<wchar_t, char, mbstate_t>::id;
!   locale::id num_get<wchar_t>::id;
!   locale::id num_put<wchar_t>::id;
!   locale::id numpunct<wchar_t>::id;
!   locale::id collate<wchar_t>::id;
!   locale::id time_get<wchar_t>::id;
!   locale::id time_put<wchar_t>::id;
!   locale::id money_get<wchar_t>::id;
!   locale::id money_put<wchar_t>::id;
!   locale::id moneypunct<wchar_t, false>::id;
!   locale::id moneypunct<wchar_t, true>::id;
!   locale::id messages<wchar_t>::id;
  #endif
! 
!   // Definitions for static const data members of locale::id
!   size_t locale::id::_S_highwater;  // init'd to 0 by linker
! 
!   // Definitions for static const data members of locale::_Impl
    const locale::id* const
    locale::_Impl::_S_id_ctype[] =
    {
      &std::ctype<char>::id, 
      &codecvt<char, char, mbstate_t>::id,
  #ifdef _GLIBCPP_USE_WCHAR_T
+     &std::ctype<wchar_t>::id,
      &codecvt<wchar_t, char, mbstate_t>::id,
  #endif
      0
    };
  
    const locale::id* const
!   locale::_Impl::_S_id_numeric[] =
    {
!     &num_get<char>::id,  
!     &num_put<char>::id,  
!     &numpunct<char>::id, 
  #ifdef _GLIBCPP_USE_WCHAR_T
!     &num_get<wchar_t>::id,
!     &num_put<wchar_t>::id,
!     &numpunct<wchar_t>::id,
  #endif
      0
    };
!   
    const locale::id* const
!   locale::_Impl::_S_id_collate[] =
    {
!     &std::collate<char>::id,
  #ifdef _GLIBCPP_USE_WCHAR_T
!     &std::collate<wchar_t>::id,
  #endif
      0
    };
! 
    const locale::id* const
    locale::_Impl::_S_id_time[] =
    {
      &time_get<char>::id, 
      &time_put<char>::id, 
  #ifdef _GLIBCPP_USE_WCHAR_T
+     &time_get<wchar_t>::id,
      &time_put<wchar_t>::id,
  #endif
      0
    };
    
    const locale::id* const
!   locale::_Impl::_S_id_monetary[] =
    {
!     &money_get<char>::id,        
!     &money_put<char>::id,        
!     &moneypunct<char, false>::id, 
!     &moneypunct<char, true >::id, 
  #ifdef _GLIBCPP_USE_WCHAR_T
!     &money_get<wchar_t>::id,
!     &money_put<wchar_t>::id,
!     &moneypunct<wchar_t, false>::id,
!     &moneypunct<wchar_t, true >::id,
  #endif
!     0
!   };
! 
!   const locale::id* const
!   locale::_Impl::_S_id_messages[] =
!   {
!     &std::messages<char>::id, 
  #ifdef _GLIBCPP_USE_WCHAR_T
!     &std::messages<wchar_t>::id,
  #endif
      0
    };
*************** namespace std {
*** 155,172 ****
    locale::_Impl::_S_facet_categories[] =
    {
      // Order must match the decl order in class locale.
-     locale::_Impl::_S_id_collate,
      locale::_Impl::_S_id_ctype,
-     locale::_Impl::_S_id_monetary,
      locale::_Impl::_S_id_numeric,
      locale::_Impl::_S_id_time,
      locale::_Impl::_S_id_messages,
      0
    };
  
-   // Definitions for static const data members of locale::id
-   size_t locale::id::_S_highwater;  // init'd to 0 by linker
- 
    // Definitions for static const data members of money_base
    const money_base::pattern 
    money_base::_S_default_pattern =  {{symbol, sign, none, value}};;
--- 171,185 ----
    locale::_Impl::_S_facet_categories[] =
    {
      // Order must match the decl order in class locale.
      locale::_Impl::_S_id_ctype,
      locale::_Impl::_S_id_numeric,
+     locale::_Impl::_S_id_collate,
      locale::_Impl::_S_id_time,
+     locale::_Impl::_S_id_monetary,
      locale::_Impl::_S_id_messages,
      0
    };
  
    // Definitions for static const data members of money_base
    const money_base::pattern 
    money_base::_S_default_pattern =  {{symbol, sign, none, value}};;
*************** namespace std {
*** 794,801 ****
    // Platform-specific initialization code for ctype tables.
    #include <bits/ctype_noninline.h>
  
-   locale::id ctype<char>::id;
- 
    const size_t ctype<char>::table_size;
  
    ctype<char>::~ctype()
--- 807,812 ----
*************** namespace std {
*** 846,853 ****
    : ctype<char>(new mask[table_size], true, __refs)
    { }
  
-   locale::id collate<char>::id;
- 
    collate<char>::collate(size_t __refs)
    : _Collate<char>(__refs) { }
    
--- 857,862 ----
*************** namespace std {
*** 903,910 ****
    : messages<char>(__refs) { }
  
  #ifdef _GLIBCPP_USE_WCHAR_T  
-   locale::id ctype<wchar_t>::id;
- 
    ctype<wchar_t>::__wmask_type
    ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
    {
--- 912,917 ----
*************** namespace std {
*** 1059,1066 ****
    ctype_byname<wchar_t>::
    ctype_byname(const char* /*__s*/, size_t __refs)
    : ctype<wchar_t>(__refs) { }
- 
-   locale::id collate<wchar_t>::id;
  
    collate<wchar_t>::
    collate(size_t __refs)
--- 1066,1071 ----
Index: src/localename.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/localename.cc,v
retrieving revision 1.9
diff -c -p -r1.9 localename.cc
*** localename.cc	2000/10/29 21:52:54	1.9
--- localename.cc	2000/12/22 11:00:03
*************** namespace std {
*** 122,132 ****
      static void(_Impl::* ctors[]) (const char*) = 
      {
        //  NB: Order must match the decl order in class locale.
-       &locale::_Impl::_M_construct_collate,
        &locale::_Impl::_M_construct_ctype,
-       &locale::_Impl::_M_construct_monetary,
        &locale::_Impl::_M_construct_numeric,
        &locale::_Impl::_M_construct_time,
        &locale::_Impl::_M_construct_messages,
        0
      };
--- 122,132 ----
      static void(_Impl::* ctors[]) (const char*) = 
      {
        //  NB: Order must match the decl order in class locale.
        &locale::_Impl::_M_construct_ctype,
        &locale::_Impl::_M_construct_numeric,
+       &locale::_Impl::_M_construct_collate,
        &locale::_Impl::_M_construct_time,
+       &locale::_Impl::_M_construct_monetary,
        &locale::_Impl::_M_construct_messages,
        0
      };
*************** namespace std {
*** 166,172 ****
    locale::_Impl::
    _M_replace_categories(const _Impl* __other, category __cat)
    {
!     unsigned int __mask = locale::all & -static_cast<unsigned int>(locale::all);
      for (unsigned int __ix = 0; (-__mask & __cat) != 0; ++__ix, (__mask <<= 1))
        {
  	if (__mask & __cat)
--- 166,172 ----
    locale::_Impl::
    _M_replace_categories(const _Impl* __other, category __cat)
    {
!     category  __mask = locale::all & -static_cast<unsigned int>(locale::all);
      for (unsigned int __ix = 0; (-__mask & __cat) != 0; ++__ix, (__mask <<= 1))
        {
  	if (__mask & __cat)
*************** namespace std {
*** 225,297 ****
      _M_facet_init(new collate_byname<char>(__name, 0));
  #ifdef _GLIBCPP_USE_WCHAR_T
      _M_facet_init(new collate_byname<wchar_t>(__name, 0));
! #endif /* _GLIBCPP_USE_WCHAR_T */
    }
  
    void 
    locale::_Impl::_M_construct_ctype(const char* __name)
    {
      _M_facet_init(new ctype_byname<char>(__name, 0));
- #ifdef _GLIBCPP_USE_WCHAR_T
-     _M_facet_init(new ctype_byname<wchar_t>(__name, 0));
- #endif /* _GLIBCPP_USE_WCHAR_T */
      _M_facet_init(new codecvt_byname<char, char, mbstate_t>(__name));
  #ifdef _GLIBCPP_USE_WCHAR_T
      _M_facet_init(new codecvt_byname<wchar_t, char, mbstate_t>(__name));
! #endif /* _GLIBCPP_USE_WCHAR_T */
    }
      
    void 
    locale::_Impl::_M_construct_monetary(const char* __name)
    {
      _M_facet_init(new moneypunct_byname<char, false>(__name, 0));
- #ifdef _GLIBCPP_USE_WCHAR_T
-     _M_facet_init(new moneypunct_byname<wchar_t, false>(__name, 0));
- #endif /* _GLIBCPP_USE_WCHAR_T */
      _M_facet_init(new moneypunct_byname<char, true >(__name, 0));
  #ifdef _GLIBCPP_USE_WCHAR_T
-     _M_facet_init(new moneypunct_byname<wchar_t, true >(__name, 0));
- #endif /* _GLIBCPP_USE_WCHAR_T */
- 
-     _M_replace_facet(locale::_S_classic, &money_get<char>::id);
- #ifdef _GLIBCPP_USE_WCHAR_T
      _M_replace_facet(locale::_S_classic, &money_get<wchar_t>::id);
- #endif /* _GLIBCPP_USE_WCHAR_T */
-     _M_replace_facet(locale::_S_classic, &money_put<char>::id);
- #ifdef _GLIBCPP_USE_WCHAR_T
      _M_replace_facet(locale::_S_classic, &money_put<wchar_t>::id);
! #endif /* _GLIBCPP_USE_WCHAR_T */
    }
      
    void 
    locale::_Impl::_M_construct_numeric(const char* __name)
    {
-     _M_facet_init(new numpunct_byname<char>(__name, 0));
- #ifdef _GLIBCPP_USE_WCHAR_T
-     _M_facet_init(new numpunct_byname<wchar_t>(__name, 0));
- #endif /* _GLIBCPP_USE_WCHAR_T */
- 
      _M_replace_facet(locale::_S_classic, &num_get<char>::id);
- #ifdef _GLIBCPP_USE_WCHAR_T
-     _M_replace_facet(locale::_S_classic, &num_get<wchar_t>::id);
- #endif /* _GLIBCPP_USE_WCHAR_T */
      _M_replace_facet(locale::_S_classic, &num_put<char>::id);
  #ifdef _GLIBCPP_USE_WCHAR_T
      _M_replace_facet(locale::_S_classic, &num_put<wchar_t>::id);
! #endif /* _GLIBCPP_USE_WCHAR_T */
    }
      
    void 
    locale::_Impl::_M_construct_time(const char* __name)
    {
      _M_facet_init(new time_get_byname<char>(__name, 0));
- #ifdef _GLIBCPP_USE_WCHAR_T
-     _M_facet_init(new time_get_byname<wchar_t>(__name, 0));
- #endif /* _GLIBCPP_USE_WCHAR_T */
      _M_facet_init(new time_put_byname<char>(__name, 0));
  #ifdef _GLIBCPP_USE_WCHAR_T
      _M_facet_init(new time_put_byname<wchar_t>(__name, 0));
! #endif /* _GLIBCPP_USE_WCHAR_T */
    }
      
    void 
--- 225,281 ----
      _M_facet_init(new collate_byname<char>(__name, 0));
  #ifdef _GLIBCPP_USE_WCHAR_T
      _M_facet_init(new collate_byname<wchar_t>(__name, 0));
! #endif 
    }
  
    void 
    locale::_Impl::_M_construct_ctype(const char* __name)
    {
      _M_facet_init(new ctype_byname<char>(__name, 0));
      _M_facet_init(new codecvt_byname<char, char, mbstate_t>(__name));
  #ifdef _GLIBCPP_USE_WCHAR_T
+     _M_facet_init(new ctype_byname<wchar_t>(__name, 0));
      _M_facet_init(new codecvt_byname<wchar_t, char, mbstate_t>(__name));
! #endif 
    }
      
    void 
    locale::_Impl::_M_construct_monetary(const char* __name)
    {
+     _M_replace_facet(locale::_S_classic, &money_get<char>::id);
+     _M_replace_facet(locale::_S_classic, &money_put<char>::id);
      _M_facet_init(new moneypunct_byname<char, false>(__name, 0));
      _M_facet_init(new moneypunct_byname<char, true >(__name, 0));
  #ifdef _GLIBCPP_USE_WCHAR_T
      _M_replace_facet(locale::_S_classic, &money_get<wchar_t>::id);
      _M_replace_facet(locale::_S_classic, &money_put<wchar_t>::id);
!     _M_facet_init(new moneypunct_byname<wchar_t, false>(__name, 0));
!     _M_facet_init(new moneypunct_byname<wchar_t, true >(__name, 0));
! #endif
    }
      
    void 
    locale::_Impl::_M_construct_numeric(const char* __name)
    {
      _M_replace_facet(locale::_S_classic, &num_get<char>::id);
      _M_replace_facet(locale::_S_classic, &num_put<char>::id);
+     _M_facet_init(new numpunct_byname<char>(__name, 0));
  #ifdef _GLIBCPP_USE_WCHAR_T
+     _M_replace_facet(locale::_S_classic, &num_get<wchar_t>::id);
      _M_replace_facet(locale::_S_classic, &num_put<wchar_t>::id);
!     _M_facet_init(new numpunct_byname<wchar_t>(__name, 0));
! #endif 
    }
      
    void 
    locale::_Impl::_M_construct_time(const char* __name)
    {
      _M_facet_init(new time_get_byname<char>(__name, 0));
      _M_facet_init(new time_put_byname<char>(__name, 0));
  #ifdef _GLIBCPP_USE_WCHAR_T
+     _M_facet_init(new time_get_byname<wchar_t>(__name, 0));
      _M_facet_init(new time_put_byname<wchar_t>(__name, 0));
! #endif 
    }
      
    void 
*************** namespace std {
*** 300,306 ****
      _M_facet_init(new messages_byname<char>(__name, 0));
  #ifdef _GLIBCPP_USE_WCHAR_T
      _M_facet_init(new messages_byname<wchar_t>(__name, 0));
! #endif /* _GLIBCPP_USE_WCHAR_T */
    }
  }
  
--- 284,290 ----
      _M_facet_init(new messages_byname<char>(__name, 0));
  #ifdef _GLIBCPP_USE_WCHAR_T
      _M_facet_init(new messages_byname<wchar_t>(__name, 0));
! #endif 
    }
  }
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]