epoc32/include/stdapis/stlportv5/stl/_monetary.c
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2  * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     3  *
     4  * Copyright (c) 1999
     5  * Silicon Graphics Computer Systems, Inc.
     6  *
     7  * Copyright (c) 1999
     8  * Boris Fomitchev
     9  *
    10  * This material is provided "as is", with absolutely no warranty expressed
    11  * or implied. Any use is at your own risk.
    12  *
    13  * Permission to use or copy this software for any purpose is hereby granted
    14  * without fee, provided the above notices are retained on all copies.
    15  * Permission to modify the code and to distribute modified code is granted,
    16  * provided the above notices are retained, and a notice that the code was
    17  * modified is included with the above copyright notice.
    18  *
    19  */
    20 #ifndef _STLP_MONETARY_C
    21 #define _STLP_MONETARY_C
    22 
    23 # ifndef _STLP_INTERNAL_MONETARY_H
    24 #  include <stl/_monetary.h>
    25 # endif
    26 
    27 #ifndef _STLP_INTERNAL_IOS_H
    28 # include <stl/_ios.h>
    29 #endif
    30 
    31 #ifndef _STLP_INTERNAL_NUM_PUT_H
    32 # include <stl/_num_put.h>
    33 #endif
    34 
    35 #ifndef _STLP_INTERNAL_NUM_GET_H
    36 # include <stl/_num_get.h>
    37 #endif
    38 
    39 _STLP_BEGIN_NAMESPACE
    40 
    41 #if (_STLP_STATIC_TEMPLATE_DATA > 0)
    42 #if !defined(__SYMBIAN32__WSD__) 
    43 
    44 #  if !defined (__BORLANDC__) &&  (defined (__SYMBIAN32__) && defined(_STLP_DESIGNATED_DLL))
    45 template <class _CharT, class _InputIterator>
    46 locale::id money_get<_CharT, _InputIterator>::id;
    47 
    48 template <class _CharT, class _OutputIterator>
    49 locale::id money_put<_CharT, _OutputIterator>::id;
    50 #  endif
    51 
    52 #  if ((defined (__CYGWIN__) || defined (__MINGW32__)) && \
    53        defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)) || (defined (__SYMBIAN32__) && defined(_STLP_DESIGNATED_DLL))
    54 /*
    55  * Under cygwin, when STLport is used as a shared library, the id needs
    56  * to be specified as imported otherwise they will be duplicated in the
    57  * calling executable.
    58  */
    59 #if defined (__SYMBIAN32__)
    60 template <>
    61 locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id; //_STLP_DECLSPEC removed; data should not be exported in symbian.
    62 /*
    63 template <>
    64 _STLP_DECLSPEC locale::id money_get<char, const char*>::id;  
    65 */
    66 
    67 template <>
    68 locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
    69 template <>
    70 locale::id money_put<char, char*>::id;
    71 
    72 #    if !defined (_STLP_NO_WCHAR_T)
    73 template <>
    74 locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
    75 template <>
    76 locale::id money_get<wchar_t, const wchar_t*>::id;
    77 
    78 template <>
    79 locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
    80 template <>
    81 locale::id money_put<wchar_t, wchar_t*>::id;
    82 #  endif  /* _STLP_NO_WCHAR_T */ 
    83 
    84 #else
    85 template <>
    86 _STLP_DECLSPEC locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
    87 /*
    88 template <>
    89 _STLP_DECLSPEC locale::id money_get<char, const char*>::id;
    90 */
    91 
    92 template <>
    93 _STLP_DECLSPEC locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
    94 template <>
    95 _STLP_DECLSPEC locale::id money_put<char, char*>::id;
    96 
    97 #    if !defined (_STLP_NO_WCHAR_T)
    98 template <>
    99 _STLP_DECLSPEC locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
   100 template <>
   101 _STLP_DECLSPEC locale::id money_get<wchar_t, const wchar_t*>::id;
   102 
   103 template <>
   104 _STLP_DECLSPEC locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
   105 template <>
   106 _STLP_DECLSPEC locale::id money_put<wchar_t, wchar_t*>::id;
   107 #  endif  /* _STLP_NO_WCHAR_T */ 
   108 
   109 #endif
   110 
   111 #endif /* (defined (__CYGWIN__) || defined (__MINGW32__)) */
   112 #endif  /* __SYMBIAN32__WSD__ */
   113 
   114 #else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   115 
   116 //typedef money_get<char, const char*> money_get_char;
   117 //typedef money_put<char, char*> money_put_char;
   118 typedef money_get<char, istreambuf_iterator<char, char_traits<char> > > money_get_char_2;
   119 typedef money_put<char, ostreambuf_iterator<char, char_traits<char> > > money_put_char_2;
   120 
   121 //__DECLARE_INSTANCE(locale::id, money_get_char::id, );
   122 //__DECLARE_INSTANCE(locale::id, money_put_char::id, );
   123 __DECLARE_INSTANCE(locale::id, money_get_char_2::id, );
   124 __DECLARE_INSTANCE(locale::id, money_put_char_2::id, );
   125 
   126 #  ifndef _STLP_NO_WCHAR_T
   127 
   128 //typedef money_get<wchar_t, const wchar_t*> money_get_wchar_t;
   129 //typedef money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_get_wchar_t_2;
   130 typedef money_put<wchar_t, wchar_t*> money_put_wchar_t;
   131 typedef money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_put_wchar_t_2;
   132 
   133 //__DECLARE_INSTANCE(locale::id, money_get_wchar_t::id, );
   134 //__DECLARE_INSTANCE(locale::id, money_put_wchar_t::id, );
   135 __DECLARE_INSTANCE(locale::id, money_get_wchar_t_2::id, );
   136 __DECLARE_INSTANCE(locale::id, money_put_wchar_t_2::id, );
   137 
   138 #  endif /* _STLP_NO_WCHAR_T */
   139 #endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
   140 
   141 // money_get facets
   142 
   143 _STLP_MOVE_TO_PRIV_NAMESPACE
   144 
   145 // helper functions for do_get
   146 template <class _InIt1, class _InIt2>
   147 pair<_InIt1, bool> __get_string( _InIt1 __first, _InIt1 __last,
   148                                  _InIt2 __str_first, _InIt2 __str_last) {
   149   while ( __first != __last && __str_first != __str_last && *__first == *__str_first ) {
   150     ++__first;
   151     ++__str_first;
   152   }
   153   return make_pair(__first, __str_first == __str_last);
   154 }
   155 
   156 template <class _InIt, class _OuIt, class _CharT>
   157 bool
   158 __get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite,
   159                      const ctype<_CharT>& _c_type,
   160                      _CharT __point, int __frac_digits, _CharT __sep,
   161                      const string& __grouping, bool &__syntax_ok) {
   162   if (__first == __last || !_c_type.is(ctype_base::digit, *__first))
   163     return false;
   164 
   165   char __group_sizes[128];
   166   char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes;
   167   char   __current_group_size = 0;
   168 
   169   while (__first != __last) {
   170     if (_c_type.is(ctype_base::digit, *__first)) {
   171       ++__current_group_size;
   172       *__out_ite++ = *__first++;
   173     }
   174     else if (__group_sizes_end) {
   175       if (*__first == __sep) {
   176         *__group_sizes_end++ = __current_group_size;
   177         __current_group_size = 0;
   178         ++__first;
   179       }
   180       else break;
   181     }
   182     else
   183       break;
   184   }
   185 
   186   if (__grouping.empty())
   187     __syntax_ok = true;
   188   else {
   189     if (__group_sizes_end != __group_sizes)
   190       *__group_sizes_end++ = __current_group_size;
   191 
   192     __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end,
   193                                    __grouping.data(), __grouping.data()+ __grouping.size());
   194 
   195     if (__first == __last || *__first != __point) {
   196       for (int __digits = 0; __digits != __frac_digits; ++__digits)
   197         *__out_ite++ = _CharT('0');
   198       return true; // OK not to have decimal point
   199     }
   200   }
   201 
   202   ++__first;
   203 
   204   int __digits = 0;
   205 
   206   while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
   207       *__out_ite++ = *__first++;
   208      ++__digits;
   209   }
   210 
   211   __syntax_ok = __syntax_ok && (__digits == __frac_digits);
   212 
   213   return true;
   214 }
   215 
   216 
   217 template <class _CharT, class _InputIter, class _StrType>
   218 _InputIter __money_do_get(_InputIter __s, _InputIter __end, bool  __intl,
   219                      ios_base&  __str, ios_base::iostate&  __err,
   220                      _StrType& __digits, bool &__is_positive, _CharT* /*__dummy*/) {
   221   if (__s == __end) {
   222     __err |= ios_base::eofbit;
   223     return __s;
   224   }
   225 
   226   typedef _CharT char_type;
   227   typedef _StrType string_type;
   228   typedef _InputIter iter_type;
   229   typedef moneypunct<char_type, false> _Punct;
   230   typedef moneypunct<char_type, true>  _Punct_intl;
   231   typedef ctype<char_type>             _Ctype;
   232 
   233   locale __loc = __str.getloc();
   234   const _Punct&      __punct      = use_facet<_Punct>(__loc) ;
   235   const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
   236   const _Ctype&      __c_type     = use_facet<_Ctype>(__loc) ;
   237 
   238   money_base::pattern __format = __intl ? __punct_intl.neg_format()
   239                                         : __punct.neg_format();
   240   string_type __ns = __intl ? __punct_intl.negative_sign()
   241                             : __punct.negative_sign();
   242   string_type __ps = __intl ? __punct_intl.positive_sign()
   243                             : __punct.positive_sign();
   244   int __i;
   245   bool __symbol_required = (__str.flags() & ios_base::showbase) != 0;
   246   string_type __buf;
   247   back_insert_iterator<string_type> __out_ite(__buf);
   248 
   249   for (__i = 0; __i < 4; ++__i) {
   250     switch (__format.field[__i]) {
   251     case money_base::none:
   252       if (__i == 3) {
   253         if (__c_type.is(ctype_base::space, *__s)) {
   254           __err = ios_base::failbit;
   255           return __s;
   256         }
   257         break;
   258       }
   259       while (__s != __end && __c_type.is(ctype_base::space, *__s))
   260         ++__s;
   261       break;
   262     case money_base::space:
   263       if (!__c_type.is(ctype_base::space, *__s)) {
   264         __err = ios_base::failbit;
   265         return __s;
   266       }
   267       ++__s;
   268       while (__s != __end && __c_type.is(ctype_base::space, *__s))
   269         ++__s;
   270       break;
   271     case money_base::symbol: {
   272       string_type __curs = __intl ? __punct_intl.curr_symbol()
   273                                   : __punct.curr_symbol();
   274       pair<iter_type, bool>
   275       __result  = __get_string(__s, __end, __curs.begin(), __curs.end());
   276       if (!__result.second && __symbol_required)
   277         __err = ios_base::failbit;
   278       __s = __result.first;
   279       break;
   280     }
   281     case money_base::sign: {
   282       if (__s == __end) {
   283         if (__ps.empty())
   284           break;
   285         if (__ns.empty()) {
   286           __is_positive = false;
   287           break;
   288         }
   289         __err = ios_base::failbit;
   290         return __s;
   291       }
   292       else {
   293         if (__ps.empty()) {
   294           if (__ns.empty())
   295             break;
   296           if (*__s == __ns[0]) {
   297             ++__s;
   298             __is_positive = false;
   299           }
   300           break;
   301         }
   302         else {
   303           if (*__s == __ps[0]) {
   304             ++__s;
   305             break;
   306           }
   307           if (__ns.empty())
   308             break;
   309           if (*__s == __ns[0]) {
   310             ++__s;
   311             __is_positive = false;
   312             break;
   313           }
   314           __err = ios_base::failbit;
   315         }
   316       }
   317       return __s;
   318     }
   319     case money_base::value: {
   320       char_type __point = __intl ? __punct_intl.decimal_point()
   321                                  : __punct.decimal_point();
   322       int __frac_digits = __intl ? __punct_intl.frac_digits()
   323                                  : __punct.frac_digits();
   324       string __grouping = __intl ? __punct_intl.grouping()
   325                                  : __punct.grouping();
   326       bool __syntax_ok = true;
   327 
   328       bool __result;
   329 
   330       char_type __sep = __grouping.empty() ? char_type() :
   331       __intl ? __punct_intl.thousands_sep() : __punct.thousands_sep();
   332 
   333       __result = __get_monetary_value(__s, __end, __out_ite, __c_type,
   334                                       __point, __frac_digits,
   335                                       __sep,
   336                                       __grouping, __syntax_ok);
   337 
   338       if (!__syntax_ok)
   339         __err |= ios_base::failbit;
   340       if (!__result) {
   341         __err = ios_base::failbit;
   342         return __s;
   343       }
   344       break;
   345 
   346     }                           // Close money_base::value case
   347     }                           // Close switch statement
   348   }                             // Close for loop
   349 
   350   if (__is_positive) {
   351     if (__ps.size() > 1) {
   352       pair<_InputIter, bool>
   353         __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end());
   354       __s = __result.first;
   355       if (!__result.second)
   356         __err |= ios::failbit;
   357     }
   358     if (!(__err & ios_base::failbit))
   359       __digits = __buf;
   360   }
   361   else {
   362     if (__ns.size() > 1) {
   363       pair<_InputIter, bool>
   364         __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end());
   365       __s = __result.first;
   366       if (!__result.second)
   367         __err |= ios::failbit;
   368     }
   369     if (!(__err & ios::failbit)) {
   370       __digits = __c_type.widen('-');
   371       __digits += __buf;
   372     }
   373   }
   374   if (__s == __end)
   375     __err |= ios::eofbit;
   376 
   377   return __s;
   378 }
   379 
   380 _STLP_MOVE_TO_STD_NAMESPACE
   381 
   382 //===== methods ======
   383 template <class _CharT, class _InputIter>
   384 _InputIter
   385 money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter  __end, bool  __intl,
   386                                       ios_base&  __str, ios_base::iostate& __err_,
   387                                       _STLP_LONGEST_FLOAT_TYPE& __units) const {
   388   ios_base::iostate __err = 0;                                      
   389   string_type __buf;
   390   bool __is_positive = true;
   391   __s = _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __buf, __is_positive, (_CharT*)0);
   392 
   393   if (__err == ios_base::goodbit || __err == ios_base::eofbit) {
   394     typename string_type::iterator __b = __buf.begin(), __e = __buf.end();
   395 
   396     if (!__is_positive) ++__b;
   397     // Can't use atold, since it might be wchar_t. Don't get confused by name below :
   398     // it's perfectly capable of reading long double.
   399     _STLP_PRIV __get_decimal_integer(__b, __e, __units, (_CharT*)0);
   400 
   401     if (!__is_positive) {
   402       __units = -__units;
   403     }
   404   }
   405   if ( (__err & ios_base::failbit == 1) || (__err & ios_base::eofbit == 1) ) {
   406   __err_ |= __err;
   407   }
   408   return __s;
   409 }
   410 
   411 template <class _CharT, class _InputIter>
   412 _InputIter
   413 money_get<_CharT, _InputIter>::do_get(iter_type __s, iter_type  __end, bool  __intl,
   414                                       ios_base&  __str, ios_base::iostate&  __err,
   415                                       string_type& __digits) const {
   416   bool __is_positive = true;
   417   return _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __digits, __is_positive, (_CharT*)0);
   418 }
   419 
   420 // money_put facets
   421 
   422 _STLP_MOVE_TO_PRIV_NAMESPACE
   423 
   424 template <class _CharT, class _OutputIter, class _Str_Type, class _Str>
   425 _OutputIter __money_do_put(_OutputIter __s, bool  __intl, ios_base&  __str,
   426                            _CharT __fill, const _Str& __digits, bool __check_digits,
   427                            _Str_Type * /*__dummy*/) {
   428   typedef _CharT char_type;
   429   typedef _Str_Type string_type;
   430   typedef ctype<char_type>             _Ctype;
   431   typedef moneypunct<char_type, false> _Punct;
   432   typedef moneypunct<char_type, true>  _Punct_intl;
   433 
   434   locale __loc = __str.getloc();
   435   const _Ctype&      __c_type     = use_facet<_Ctype>(__loc) ;
   436   const _Punct&      __punct      = use_facet<_Punct>(__loc) ;
   437   const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
   438 
   439   // some special characters
   440   char_type __minus = __c_type.widen('-');
   441   char_type __plus  = __c_type.widen('+');
   442   char_type __space = __c_type.widen(' ');
   443   char_type __zero  = __c_type.widen('0');
   444   char_type __point = __intl ? __punct_intl.decimal_point()
   445                              : __punct.decimal_point();
   446 
   447   char_type __sep = __intl ? __punct_intl.thousands_sep()
   448                            : __punct.thousands_sep();
   449 
   450   string __grouping = __intl ? __punct_intl.grouping()
   451                              : __punct.grouping();
   452 
   453   int __frac_digits      = __intl ? __punct_intl.frac_digits()
   454                                   : __punct.frac_digits();
   455 
   456   string_type __curr_sym = __intl ? __punct_intl.curr_symbol()
   457                                   : __punct.curr_symbol();
   458 
   459   // if there are no digits we are going to return __s.  If there
   460   // are digits, but not enough to fill the frac_digits, we are
   461   // going to add zeros.  I don't know whether this is right or
   462   // not.
   463   if (__digits.empty())
   464     return __s;
   465 
   466   typename string_type::const_iterator __digits_first = __digits.begin();
   467   typename string_type::const_iterator __digits_last  = __digits.end();
   468 
   469   bool __is_negative = *__digits_first == __minus;
   470   if (__is_negative)
   471     ++__digits_first;
   472 
   473 #if !defined (__BORLANDC__)
   474   string_type __sign = __intl ? __is_negative ? __punct_intl.negative_sign()
   475                                               : __punct_intl.positive_sign()
   476                               : __is_negative ? __punct.negative_sign()
   477                                               : __punct.positive_sign();
   478 #else
   479   string_type __sign;
   480   if (__intl) {
   481     if (__is_negative)
   482       __sign = __punct_intl.negative_sign();
   483     else
   484       __sign = __punct_intl.positive_sign();
   485   }
   486   else {
   487     if (__is_negative)
   488       __sign = __punct.negative_sign();
   489     else
   490       __sign = __punct.positive_sign();
   491   }
   492 #endif
   493 
   494   if (__check_digits) {
   495     typename string_type::const_iterator __cp = __digits_first;
   496     while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp))
   497       ++__cp;
   498     if (__cp == __digits_first)
   499       return __s;
   500     __digits_last = __cp;
   501   }
   502 
   503   // If grouping is required, we make a copy of __digits and
   504   // insert the grouping.
   505   _STLP_BASIC_IOSTRING(char_type) __new_digits;
   506   if (!__grouping.empty()) {
   507     __new_digits.assign(__digits_first, __digits_last);
   508     __insert_grouping(__new_digits,
   509                       __new_digits.size() - __frac_digits,
   510                       __grouping,
   511                       __sep, __plus, __minus, 0);
   512     __digits_first = __new_digits.begin(); // <<--
   513     __digits_last  = __new_digits.end();   // <<--
   514   }
   515 
   516   // Determine the amount of padding required, if any.
   517   streamsize __width = __str.width();
   518 
   519 #if defined (_STLP_DEBUG) && (defined(__HP_aCC) && (__HP_aCC <= 1))
   520   size_t __value_length = operator -(__digits_last, __digits_first);
   521 #else
   522   size_t __value_length = __digits_last - __digits_first;
   523 #endif
   524 
   525   size_t __length = __value_length + __sign.size();
   526 
   527   if (__frac_digits != 0)
   528     ++__length;
   529 
   530   bool __generate_curr = (__str.flags() & ios_base::showbase) !=0;
   531   if (__generate_curr)
   532     __length += __curr_sym.size();
   533   money_base::pattern __format = __intl ? (__is_negative ? __punct_intl.neg_format()
   534                                                          : __punct_intl.pos_format())
   535                                         : (__is_negative ? __punct.neg_format()
   536                                                          : __punct.pos_format());
   537   {
   538     //For the moment the following is commented for decoding reason.
   539     //No reason to add a space last if the money symbol do not have to be display
   540     //if (__format.field[3] == (char) money_base::symbol && !__generate_curr) {
   541     //  if (__format.field[2] == (char) money_base::space) {
   542     //    __format.field[2] = (char) money_base::none;
   543     //  }
   544     //}
   545     //space can only be second or third and only once (22.2.6.3-1):
   546     if ((__format.field[1] == (char) money_base::space) ||
   547         (__format.field[2] == (char) money_base::space))
   548       ++__length;
   549   }
   550 
   551   const bool __need_fill = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __length) < __width)) ||
   552                             ((sizeof(streamsize) <= sizeof(size_t)) && (__length < __STATIC_CAST(size_t, __width))));
   553   streamsize __fill_amt = __need_fill ? __width - __length : 0;
   554 
   555   ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield;
   556 
   557   if (__fill_amt != 0 &&
   558       !(__fill_pos & (ios_base::left | ios_base::internal)))
   559     __s = __fill_n(__s, __fill_amt, __fill);
   560 
   561   for (int __i = 0; __i < 4; ++__i) {
   562     char __ffield = __format.field[__i];
   563     switch (__ffield) {
   564       case money_base::none:
   565         if (__fill_amt != 0 && __fill_pos == ios_base::internal)
   566           __s = __fill_n(__s, __fill_amt, __fill);
   567         break;
   568       case money_base::space:
   569     	if( !__need_fill )
   570     		{
   571     	    *__s++ = __space;
   572     	    }
   573     	else
   574     		{
   575     		*__s++ = __fill;
   576     		}
   577         if (__fill_amt != 0 && __fill_pos == ios_base::internal)
   578           __s = __fill_n(__s, __fill_amt, __fill);
   579         break;
   580       case money_base::symbol:
   581         if (__generate_curr)
   582           __s = copy(__curr_sym.begin(), __curr_sym.end(), __s);
   583         break;
   584       case money_base::sign:
   585         if (!__sign.empty())
   586           *__s++ = __sign[0];
   587         break;
   588       case money_base::value:
   589         if (__frac_digits == 0) {
   590           __s = copy(__digits_first, __digits_last, __s);
   591         } else {
   592           if ((int)__value_length <= __frac_digits) {
   593             // if we see '9' here, we should out 0.09
   594             *__s++ = __zero;  // integer part is zero
   595             *__s++ = __point; // decimal point
   596             __s =  __fill_n(__s, __frac_digits - __value_length, __zero); // zeros
   597             __s = copy(__digits_first, __digits_last, __s); // digits
   598           } else {
   599             __s = copy(__digits_first, __digits_last - __frac_digits, __s);
   600             if (__frac_digits != 0) {
   601               *__s++ = __point;
   602               __s = copy(__digits_last - __frac_digits, __digits_last, __s);
   603             }
   604           }
   605         }
   606         break;
   607     } //Close for switch
   608   } // Close for loop
   609 
   610   // Ouput rest of sign if necessary.
   611   if (__sign.size() > 1)
   612     __s = copy(__sign.begin() + 1, __sign.end(), __s);
   613   if (__fill_amt != 0 &&
   614       !(__fill_pos & (ios_base::right | ios_base::internal)))
   615     __s = __fill_n(__s, __fill_amt, __fill);
   616 
   617   return __s;
   618 }
   619 
   620 _STLP_MOVE_TO_STD_NAMESPACE
   621 
   622 template <class _CharT, class _OutputIter>
   623 _OutputIter
   624 money_put<_CharT, _OutputIter>
   625  ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
   626           char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const {
   627   _STLP_BASIC_IOSTRING(char_type) __digits;
   628   _STLP_PRIV __get_money_digits(__digits, __str, __units);
   629   return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, false, __STATIC_CAST(string_type*, 0));
   630 }
   631 
   632 template <class _CharT, class _OutputIter>
   633 _OutputIter
   634 money_put<_CharT, _OutputIter>
   635  ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
   636           char_type __fill, const string_type& __digits) const {
   637   return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, true, __STATIC_CAST(string_type*, 0));
   638 }
   639 
   640 _STLP_END_NAMESPACE
   641 
   642 #endif /* _STLP_MONETARY_C */
   643 
   644 // Local Variables:
   645 // mode:C++
   646 // End: