dlls/msvcp100/locale.c
static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
        ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
{
    numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
    basic_string_char grouping_bstr;
    const char *grouping;
    char *p, sep = *localeconv()->decimal_point;
    int cur_group = 0, group_size = 0;
    int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
    MSVCP_size_t pad;

    TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);

    /* Change decimal point */
    for(p=buf; p<buf+count; p++) {
        if(*p == sep) {
            *p = numpunct_char_decimal_point(numpunct);
            break;
        }
    }
    p--;

    /* Add separators to number */
    numpunct_char_grouping(numpunct, &grouping_bstr);
    grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
    sep = grouping[0] ? numpunct_char_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 = sep;
            count++;
        }
    }
    MSVCP_basic_string_char_dtor(&grouping_bstr);

    /* Display number with padding */
    if(count >= base->wide)
        pad = 0;
    else
        pad = base->wide-count;
    base->wide = 0;

    if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
        num_put_char__Putc(this, &dest, dest, buf, 1);
        buf++;
    }
    if(adjustfield != FMTFLAG_left) {
        num_put_char__Rep(this, ret, dest, fill, pad);
        pad = 0;
    }
    num_put_char__Putc(this, &dest, dest, buf, count);
    return num_put_char__Rep(this, ret, dest, fill, pad);
}
/* TODO: This function should be removed when num_put_char__Fput is implemented */
This function should be removed when num_put_char__Fput is implemented
This function should be removed when num_put_char__Fput is implemented
static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
        ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
{
    numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
    basic_string_char grouping_bstr;
    const char *grouping;
    char *p, sep = *localeconv()->decimal_point;
    int cur_group = 0, group_size = 0;
    int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
    MSVCP_size_t pad;
    TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
    for(p=buf; p<buf+count; p++) {
        if(*p == sep) {
            *p = numpunct_char_decimal_point(numpunct);
            break;
        }
    }
    p--;
    numpunct_char_grouping(numpunct, &grouping_bstr);
    grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
    sep = grouping[0] ? numpunct_char_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 = sep;
            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_char__Putc(this, &dest, dest, buf, 1);
        buf++;
    }
    if(adjustfield != FMTFLAG_left) {
        num_put_char__Rep(this, ret, dest, fill, pad);
        pad = 0;
    }
    num_put_char__Putc(this, &dest, dest, buf, count);
    return num_put_char__Rep(this, ret, dest, fill, pad);
}
static ostreambuf_iterator_char * num_put_char_fput ( const num_put * this , ostreambuf_iterator_char * ret , ostreambuf_iterator_char dest , ios_base * base , char fill , char * buf , MSVCP_size_t count ) { numpunct_char * numpunct = numpunct_char_use_facet ( base -> loc ) ; basic_string_char grouping_bstr ; const char * grouping ; char * p , sep = * localeconv ( ) -> decimal_point ; int cur_group = 0 , group_size = 0 ; int adjustfield = base -> fmtfl & FMTFLAG_adjustfield ; MSVCP_size_t pad ; TRACE ( " \n " , this , ret , base , fill , buf , count ) ; for ( p = buf ; p < buf + count ; p ++ ) { if ( * p == sep ) { * p = numpunct_char_decimal_point ( numpunct ) ; break ; } } p -- ; numpunct_char_grouping ( numpunct , & grouping_bstr ) ; grouping = MSVCP_basic_string_char_c_str ( & grouping_bstr ) ; sep = grouping [ 0 ] ? numpunct_char_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 = sep ; 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_char__Putc ( this , & dest , dest , buf , 1 ) ; buf ++ ; } if ( adjustfield != FMTFLAG_left ) { num_put_char__Rep ( this , ret , dest , fill , pad ) ; pad = 0 ; } num_put_char__Putc ( this , & dest , dest , buf , count ) ; return num_put_char__Rep ( this , ret , dest , fill , pad ) ; }
TODO: This function should be removed when num_put_char__Fput is implemented
TODO : This function should be removed when num_put_char__Fput is implemented
/* Change decimal point */ /* Add separators to number */ /* Display number with padding */