Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.7 KiB

  1. // wlocale -- class locale wide member functions
  2. #include <istream>
  3. #include <locale>
  4. #include <xdebug>
  5. _STD_BEGIN
  6. #pragma warning(disable: 4786)
  7. typedef char_traits<wchar_t> _Wtraits;
  8. typedef istreambuf_iterator<wchar_t, _Wtraits> _Winiter;
  9. typedef ostreambuf_iterator<wchar_t, _Wtraits> _Woutiter;
  10. // facets associated with C categories
  11. #define ADDFAC(Facet, cat, ptrimp, ptrloc) \
  12. if ((_CATMASK(Facet::_Getcat()) & cat) == 0) \
  13. ; \
  14. else if (ptrloc == 0) \
  15. ptrimp->_Addfac(_NEW_CRT Facet(lobj), Facet::id); \
  16. else \
  17. ptrimp->_Addfac((locale::facet *)&_USE(*ptrloc, Facet), Facet::id);
  18. // moved from locale to ease subsetting
  19. typedef ctype<wchar_t> _Tw1;
  20. typedef num_get<wchar_t, _Winiter> _Tw2;
  21. typedef num_put<wchar_t, _Woutiter> _Tw3;
  22. typedef numpunct<wchar_t> _Tw4;
  23. typedef collate<wchar_t> _Tw5;
  24. typedef messages<wchar_t> _Tw6;
  25. typedef money_get<wchar_t, _Winiter> _Tw7;
  26. typedef money_put<wchar_t, _Woutiter> _Tw9;
  27. typedef moneypunct<wchar_t, false> _Tw11;
  28. typedef moneypunct<wchar_t, true> _Tw12;
  29. typedef time_get<wchar_t, _Winiter> _Tw13;
  30. typedef time_put<wchar_t, _Woutiter> _Tw14;
  31. //....
  32. typedef codecvt<wchar_t, char, mbstate_t> _Twc1;
  33. _TEMPLATE_STAT locale::id time_put<wchar_t>::id;
  34. void __cdecl locale::_Locimp::_Makewloc(const _Locinfo& lobj,
  35. locale::category cat, _Locimp *ptrimp, const locale *ptrloc)
  36. { // setup wide part of a new locale
  37. ADDFAC(_Tw1, cat, ptrimp, ptrloc);
  38. ADDFAC(_Tw2, cat, ptrimp, ptrloc);
  39. ADDFAC(_Tw3, cat, ptrimp, ptrloc);
  40. ADDFAC(_Tw4, cat, ptrimp, ptrloc);
  41. ADDFAC(_Tw5, cat, ptrimp, ptrloc);
  42. ADDFAC(_Tw6, cat, ptrimp, ptrloc);
  43. ADDFAC(_Tw7, cat, ptrimp, ptrloc);
  44. ADDFAC(_Tw9, cat, ptrimp, ptrloc);
  45. ADDFAC(_Tw11, cat, ptrimp, ptrloc);
  46. ADDFAC(_Tw12, cat, ptrimp, ptrloc);
  47. ADDFAC(_Tw13, cat, ptrimp, ptrloc);
  48. ADDFAC(_Tw14, cat, ptrimp, ptrloc);
  49. //...
  50. ADDFAC(_Twc1, cat, ptrimp, ptrloc);
  51. }
  52. #ifdef _NATIVE_WCHAR_T_DEFINED
  53. typedef char_traits<unsigned short> _UShtraits;
  54. typedef istreambuf_iterator<unsigned short, _UShtraits> _UShiniter;
  55. typedef ostreambuf_iterator<unsigned short, _UShtraits> _UShoutiter;
  56. // moved from locale to ease subsetting
  57. typedef ctype<unsigned short> _Tush1;
  58. typedef num_get<unsigned short, _UShiniter> _Tush2;
  59. typedef num_put<unsigned short, _UShoutiter> _Tush3;
  60. typedef numpunct<unsigned short> _Tush4;
  61. typedef collate<unsigned short> _Tush5;
  62. typedef messages<unsigned short> _Tush6;
  63. typedef money_get<unsigned short, _UShiniter> _Tush7;
  64. typedef money_put<unsigned short, _UShoutiter> _Tush9;
  65. typedef moneypunct<unsigned short, false> _Tush11;
  66. typedef moneypunct<unsigned short, true> _Tush12;
  67. typedef time_get<unsigned short, _UShiniter> _Tush13;
  68. typedef time_put<unsigned short, _UShoutiter> _Tush14;
  69. //....
  70. typedef codecvt<unsigned short, char, mbstate_t> _Tushc1;
  71. _TEMPLATE_STAT locale::id time_put<unsigned short>::id;
  72. void __cdecl locale::_Locimp::_Makeushloc(const _Locinfo& lobj,
  73. locale::category cat, _Locimp *ptrimp, const locale *ptrloc)
  74. { // setup wide part of a new locale
  75. ADDFAC(_Tush1, cat, ptrimp, ptrloc);
  76. ADDFAC(_Tush2, cat, ptrimp, ptrloc);
  77. ADDFAC(_Tush3, cat, ptrimp, ptrloc);
  78. ADDFAC(_Tush4, cat, ptrimp, ptrloc);
  79. ADDFAC(_Tush5, cat, ptrimp, ptrloc);
  80. ADDFAC(_Tush6, cat, ptrimp, ptrloc);
  81. ADDFAC(_Tush7, cat, ptrimp, ptrloc);
  82. ADDFAC(_Tush9, cat, ptrimp, ptrloc);
  83. ADDFAC(_Tush11, cat, ptrimp, ptrloc);
  84. ADDFAC(_Tush12, cat, ptrimp, ptrloc);
  85. ADDFAC(_Tush13, cat, ptrimp, ptrloc);
  86. ADDFAC(_Tush14, cat, ptrimp, ptrloc);
  87. //...
  88. ADDFAC(_Tushc1, cat, ptrimp, ptrloc);
  89. }
  90. #endif
  91. _STD_END
  92. /*
  93. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  94. * Consult your license regarding permissions and restrictions.
  95. V3.10:0009 */