OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [newlib/] [newlib/] [newlib/] [libc/] [stdio/] [vfprintf.c] - Diff between revs 39 and 56

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 39 Rev 56
Line 6... Line 6...
        vprintf
        vprintf
INDEX
INDEX
        vfprintf
        vfprintf
INDEX
INDEX
        vsprintf
        vsprintf
 
INDEX
 
        vsnprintf
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <stdio.h>
        #include <stdio.h>
        #include <stdarg.h>
        #include <stdarg.h>
        int vprintf(const char *<[fmt]>, va_list <[list]>);
        int vprintf(const char *<[fmt]>, va_list <[list]>);
        int vfprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
        int vfprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
        int vsprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
        int vsprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
 
        int vsnprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
 
 
        int _vprintf_r(void *<[reent]>, const char *<[fmt]>,
        int _vprintf_r(void *<[reent]>, const char *<[fmt]>,
                        va_list <[list]>);
                        va_list <[list]>);
        int _vfprintf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
        int _vfprintf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
                        va_list <[list]>);
                        va_list <[list]>);
        int _vsprintf_r(void *<[reent]>, char *<[str]>, const char *<[fmt]>,
        int _vsprintf_r(void *<[reent]>, char *<[str]>, const char *<[fmt]>,
                        va_list <[list]>);
                        va_list <[list]>);
 
        int _vsnprintf_r(void *<[reent]>, char *<[str]>, size_t <[size]>, const char *<[fmt]>,
 
                        va_list <[list]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <stdio.h>
        #include <stdio.h>
        #include <varargs.h>
        #include <varargs.h>
        int vprintf( <[fmt]>, <[list]>)
        int vprintf( <[fmt]>, <[list]>)
Line 38... Line 43...
        int vsprintf(<[str]>, <[fmt]>, <[list]>)
        int vsprintf(<[str]>, <[fmt]>, <[list]>)
        char *<[str]>;
        char *<[str]>;
        char *<[fmt]>;
        char *<[fmt]>;
        va_list <[list]>;
        va_list <[list]>;
 
 
 
        int vsnprintf(<[str]>, <[size]>, <[fmt]>, <[list]>)
 
        char *<[str]>;
 
        size_t <[size]>;
 
        char *<[fmt]>;
 
        va_list <[list]>;
 
 
        int _vprintf_r(<[reent]>, <[fmt]>, <[list]>)
        int _vprintf_r(<[reent]>, <[fmt]>, <[list]>)
        char *<[reent]>;
        char *<[reent]>;
        char *<[fmt]>;
        char *<[fmt]>;
        va_list <[list]>;
        va_list <[list]>;
 
 
Line 55... Line 66...
        char *<[reent]>;
        char *<[reent]>;
        char *<[str]>;
        char *<[str]>;
        char *<[fmt]>;
        char *<[fmt]>;
        va_list <[list]>;
        va_list <[list]>;
 
 
 
        int _vsnprintf_r(<[reent]>, <[str]>, <[size]>, <[fmt]>, <[list]>)
 
        char *<[reent]>;
 
        char *<[str]>;
 
        size_t <[size]>;
 
        char *<[fmt]>;
 
        va_list <[list]>;
 
 
DESCRIPTION
DESCRIPTION
<<vprintf>>, <<vfprintf>>, and <<vsprintf>> are (respectively)
<<vprintf>>, <<vfprintf>>, <<vsprintf>> and <<vsnprintf>> are (respectively)
variants of <<printf>>, <<fprintf>>, and <<sprintf>>.  They differ
variants of <<printf>>, <<fprintf>>, <<sprintf>> and <<snprintf>>.  They differ
only in allowing their caller to pass the variable argument list as a
only in allowing their caller to pass the variable argument list as a
<<va_list>> object (initialized by <<va_start>>) rather than directly
<<va_list>> object (initialized by <<va_start>>) rather than directly
accepting a variable number of arguments.
accepting a variable number of arguments.
 
 
RETURNS
RETURNS
Line 115... Line 133...
 * SUCH DAMAGE.
 * SUCH DAMAGE.
 */
 */
 
 
#if defined(LIBC_SCCS) && !defined(lint)
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)vfprintf.c   5.50 (Berkeley) 12/16/92";*/
/*static char *sccsid = "from: @(#)vfprintf.c   5.50 (Berkeley) 12/16/92";*/
static char *rcsid = "$Id: vfprintf.c,v 1.1.1.1 2000-06-10 01:18:26 lampret Exp $";
static char *rcsid = "$Id: vfprintf.c,v 1.1.1.2 2000-08-30 19:01:48 joel Exp $";
#endif /* LIBC_SCCS and not lint */
#endif /* LIBC_SCCS and not lint */
 
 
/*
/*
 * Actual printf innards.
 * Actual printf innards.
 *
 *
Line 133... Line 151...
#define VFPRINTF vfprintf
#define VFPRINTF vfprintf
#define _VFPRINTF_R _vfprintf_r
#define _VFPRINTF_R _vfprintf_r
#define FLOATING_POINT
#define FLOATING_POINT
#endif
#endif
 
 
#if 1
 
#define _NO_LONGLONG
#define _NO_LONGLONG
 
#if defined WANT_PRINTF_LONG_LONG && defined __GNUC__
 
# undef _NO_LONGLONG
#endif
#endif
 
 
#include <_ansi.h>
#include <_ansi.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
Line 151... Line 170...
#include <varargs.h>
#include <varargs.h>
#endif
#endif
 
 
#include "local.h"
#include "local.h"
#include "fvwrite.h"
#include "fvwrite.h"
 
#include "vfieeefp.h"
 
 
/*
/*
 * Flush out all the vectors defined by the given uio,
 * Flush out all the vectors defined by the given uio,
 * then reset it so that it can be reused.
 * then reset it so that it can be reused.
 */
 */
Line 313... Line 333...
         * Choose PADSIZE to trade efficiency vs. size.  If larger printf
         * Choose PADSIZE to trade efficiency vs. size.  If larger printf
         * fields occur frequently, increase PADSIZE and make the initialisers
         * fields occur frequently, increase PADSIZE and make the initialisers
         * below longer.
         * below longer.
         */
         */
#define PADSIZE 16              /* pad chunk size */
#define PADSIZE 16              /* pad chunk size */
        static char blanks[PADSIZE] =
        static _CONST char blanks[PADSIZE] =
         {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
         {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
        static char zeroes[PADSIZE] =
        static _CONST char zeroes[PADSIZE] =
         {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
         {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
 
 
        /*
        /*
         * BEWARE, these `goto error' on error, and PAD uses `n'.
         * BEWARE, these `goto error' on error, and PAD uses `n'.
         */
         */
Line 846... Line 866...
        int ndigits, flags, *decpt, ch, *length;
        int ndigits, flags, *decpt, ch, *length;
        char *sign;
        char *sign;
{
{
        int mode, dsgn;
        int mode, dsgn;
        char *digits, *bp, *rve;
        char *digits, *bp, *rve;
 
        union double_union tmp;
 
 
        if (ch == 'f') {
        if (ch == 'f') {
                mode = 3;               /* ndigits after the decimal point */
                mode = 3;               /* ndigits after the decimal point */
        } else {
        } else {
                /* To obtain ndigits after the decimal point for the 'e'
                /* To obtain ndigits after the decimal point for the 'e'
Line 860... Line 881...
                        ndigits++;
                        ndigits++;
                }
                }
                mode = 2;               /* ndigits significant digits */
                mode = 2;               /* ndigits significant digits */
        }
        }
 
 
        if (value < 0) {
        tmp.d = value;
 
        if (word0(tmp) & Sign_bit) { /* this will check for < 0 and -0.0 */
                value = -value;
                value = -value;
                *sign = '-';
                *sign = '-';
        } else
        } else
                *sign = '\000';
                *sign = '\000';
        digits = _dtoa_r(data, value, mode, ndigits, decpt, &dsgn, &rve);
        digits = _dtoa_r(data, value, mode, ndigits, decpt, &dsgn, &rve);

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.