dlls/msvcp100/locale.c
/* TODO: This function should be removed when num_put_wchar__Fput is implemented */
This function should be removed when num_put_wchar__Fput is implemented
This function should be removed when num_put_wchar__Fput is implemented
static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
        ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
        MSVCP_size_t count, numpunct_wchar *numpunct)
{
    basic_string_char grouping_bstr;
    const char *grouping;
    char *p, dec_point = *localeconv()->decimal_point;
    wchar_t sep;
    int cur_group = 0, group_size = 0;
    int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
    MSVCP_size_t i, pad;
    TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
    for(p=buf; p<buf+count; p++) {
        if(*p == dec_point)
            break;
    }
    p--;
    numpunct_wchar_grouping(numpunct, &grouping_bstr);
    grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
    sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
    for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
        group_size++;
        if(group_size == grouping[cur_group]) {
            group_size = 0;
            if(grouping[cur_group+1])
                cur_group++;
            memmove(p+1, p, buf+count-p);
            *p = '\0'; 
            count++;
        }
    }
    MSVCP_basic_string_char_dtor(&grouping_bstr);
    if(count >= base->wide)
        pad = 0;
    else
        pad = base->wide-count;
    base->wide = 0;
    if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
        num_put_wchar__Putc(this, &dest, dest, buf, 1);
        buf++;
    }
    if(adjustfield != FMTFLAG_left) {
        num_put_wchar__Rep(this, ret, dest, fill, pad);
        pad = 0;
    }
    for(i=0; i<count; i++) {
        if(buf[i] == dec_point)
            num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
        else if(!buf[i])
            num_put_wchar__Rep(this, &dest, dest, sep, 1);
        else
            num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
    }
    return num_put_wchar__Rep(this, ret, dest, fill, pad);
}
static ostreambuf_iterator_wchar * num_put__fput ( const num_put * this , ostreambuf_iterator_wchar * ret , ostreambuf_iterator_wchar dest , ios_base * base , wchar_t fill , char * buf , MSVCP_size_t count , numpunct_wchar * numpunct ) { basic_string_char grouping_bstr ; const char * grouping ; char * p , dec_point = * localeconv ( ) -> decimal_point ; wchar_t sep ; int cur_group = 0 , group_size = 0 ; int adjustfield = base -> fmtfl & FMTFLAG_adjustfield ; MSVCP_size_t i , pad ; TRACE ( " \n " , this , ret , base , fill , buf , count ) ; for ( p = buf ; p < buf + count ; p ++ ) { if ( * p == dec_point ) break ; } p -- ; numpunct_wchar_grouping ( numpunct , & grouping_bstr ) ; grouping = MSVCP_basic_string_char_c_str ( & grouping_bstr ) ; sep = grouping [ 0 ] ? numpunct_wchar_thousands_sep ( numpunct ) : ' \0 ' ; for ( ; p > buf && sep && grouping [ cur_group ] != CHAR_MAX ; p -- ) { group_size ++ ; if ( group_size == grouping [ cur_group ] ) { group_size = 0 ; if ( grouping [ cur_group + 1 ] ) cur_group ++ ; memmove ( p + 1 , p , buf + count - p ) ; * p = ' \0 ' ; count ++ ; } } MSVCP_basic_string_char_dtor ( & grouping_bstr ) ; if ( count >= base -> wide ) pad = 0 ; else pad = base -> wide - count ; base -> wide = 0 ; if ( ( adjustfield & FMTFLAG_internal ) && ( buf [ 0 ] == ' ' || buf [ 0 ] == ' ' ) ) { num_put_wchar__Putc ( this , & dest , dest , buf , 1 ) ; buf ++ ; } if ( adjustfield != FMTFLAG_left ) { num_put_wchar__Rep ( this , ret , dest , fill , pad ) ; pad = 0 ; } for ( i = 0 ; i < count ; i ++ ) { if ( buf [ i ] == dec_point ) num_put_wchar__Rep ( this , & dest , dest , numpunct_wchar_decimal_point ( numpunct ) , 1 ) ; else if ( ! buf [ i ] ) num_put_wchar__Rep ( this , & dest , dest , sep , 1 ) ; else num_put_wchar__Putc ( this , & dest , dest , buf + i , 1 ) ; } return num_put_wchar__Rep ( this , ret , dest , fill , pad ) ; }
TODO: This function should be removed when num_put_wchar__Fput is implemented
TODO : This function should be removed when num_put_wchar__Fput is implemented
/* Add separators to number */ /* mark thousands separator positions */ /* Display number with padding */