#include <sys/types.h>#include <varargs.h>#include <stddef.h>#include <math.h>#include <float.h>Go to the source code of this file.
Data Structures | |
| struct | __sbuf |
| struct | __sFILE |
| struct | __siov |
| struct | __suio |
Defines | |
| #define | u_long unsigned long |
| #define | u_short unsigned short |
| #define | u_int unsigned int |
| #define | __P(x) () |
| #define | _BSD_VA_LIST_ va_list |
| #define | UNINITIALIZED_VAR(x) x |
| #define | __SLBF 0x0001 |
| #define | __SNBF 0x0002 |
| #define | __SRD 0x0004 |
| #define | __SWR 0x0008 |
| #define | __SRW 0x0010 |
| #define | __SEOF 0x0020 |
| #define | __SERR 0x0040 |
| #define | __SMBF 0x0080 |
| #define | __SAPP 0x0100 |
| #define | __SSTR 0x0200 |
| #define | __SOPT 0x0400 |
| #define | __SNPT 0x0800 |
| #define | __SOFF 0x1000 |
| #define | __SMOD 0x2000 |
| #define | EOF (-1) |
| #define | __sfeof(p) (((p)->_flags & __SEOF) != 0) |
| #define | __sferror(p) (((p)->_flags & __SERR) != 0) |
| #define | __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) |
| #define | __sfileno(p) ((p)->_file) |
| #define | feof(p) __sfeof(p) |
| #define | ferror(p) __sferror(p) |
| #define | clearerr(p) __sclearerr(p) |
| #define | fileno(p) __sfileno(p) |
| #define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
| #define | COPY(n) (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n)) |
| #define | GETIOV(extra_work) |
| #define | to_digit(c) ((c) - '0') |
| #define | is_digit(c) ((unsigned)to_digit(c) <= 9) |
| #define | to_char(n) (char)((n) + '0') |
| #define | MAXEXP (DBL_MAX_10_EXP) |
| #define | MAXFRACT (MAXEXP*10/3) |
| #define | BUF (MAXEXP+MAXFRACT+1) |
| #define | DEFPREC 6 |
| #define | ALT 0x001 |
| #define | HEXPREFIX 0x002 |
| #define | LADJUST 0x004 |
| #define | LONGDBL 0x008 |
| #define | LONGINT 0x010 |
| #define | SHORTINT 0x040 |
| #define | ZEROPAD 0x080 |
| #define | FPT 0x100 |
| #define | NIOV 8 |
| #define | PADSIZE 16 |
| #define | PRINT(ptr, len) |
| #define | PAD(howmany, with) |
| #define | PAD_L(howmany, with) PAD((howmany), (with)) |
| #define | FLUSH() |
| #define | SARG() |
| #define | UARG() |
Typedefs | |
| typedef struct __sFILE | FILE |
Functions | |
| static int | BSD__sfvwrite (FILE *fp, struct __suio *uio) |
| static int | BSD__sprint (FILE *fp, register struct __suio *uio) |
| static int | BSD__sbprintf (register FILE *fp, const char *fmt, va_list ap) |
| static char * | BSD__ultoa (register u_long val, char *endp, int base, int octzero, const char *xdigs) |
| static char *cvt | __P ((double, int, int, char *, int *, int, int *, char *)) |
| static int exponent | __P ((char *, int, int)) |
| static ssize_t | BSD_vfprintf (FILE *fp, const char *fmt0, va_list ap) |
| char *BSD__dtoa | __P ((double, int, int, int *, int *, char **)) |
| char * | BSD__hdtoa (double, const char *, int, int *, int *, char **) |
| static char * | cvt (double value, int ndigits, int flags, char *sign, int *decpt, int ch, int *length, char *buf) |
| static int | exponent (char *p0, int exp, int fmtch) |
| int | ruby_vsnprintf (char *str, size_t n, const char *fmt, va_list ap) |
| int | ruby_snprintf (char *str, size_t n, char const *fmt,...) |
| #define __P | ( | x | ) | () |
Definition at line 81 of file vsnprintf.c.
| #define __SAPP 0x0100 |
Definition at line 198 of file vsnprintf.c.
| #define __sclearerr | ( | p | ) | ((void)((p)->_flags &= ~(__SERR|__SEOF))) |
Definition at line 211 of file vsnprintf.c.
| #define __SEOF 0x0020 |
Definition at line 195 of file vsnprintf.c.
| #define __SERR 0x0040 |
Definition at line 196 of file vsnprintf.c.
| #define __sfeof | ( | p | ) | (((p)->_flags & __SEOF) != 0) |
Definition at line 209 of file vsnprintf.c.
| #define __sferror | ( | p | ) | (((p)->_flags & __SERR) != 0) |
Definition at line 210 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define __sfileno | ( | p | ) | ((p)->_file) |
Definition at line 212 of file vsnprintf.c.
| #define __SLBF 0x0001 |
Definition at line 189 of file vsnprintf.c.
Referenced by BSD__sfvwrite().
| #define __SMBF 0x0080 |
Definition at line 197 of file vsnprintf.c.
| #define __SMOD 0x2000 |
Definition at line 203 of file vsnprintf.c.
| #define __SNBF 0x0002 |
Definition at line 190 of file vsnprintf.c.
Referenced by BSD__sfvwrite(), and BSD_vfprintf().
| #define __SNPT 0x0800 |
Definition at line 201 of file vsnprintf.c.
| #define __SOFF 0x1000 |
Definition at line 202 of file vsnprintf.c.
| #define __SOPT 0x0400 |
Definition at line 200 of file vsnprintf.c.
| #define __SRD 0x0004 |
Definition at line 191 of file vsnprintf.c.
| #define __SRW 0x0010 |
Definition at line 194 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define __SSTR 0x0200 |
Definition at line 199 of file vsnprintf.c.
Referenced by BSD__sfvwrite(), rb_enc_vsprintf(), rb_str_vcatf(), ruby_snprintf(), and ruby_vsnprintf().
| #define __SWR 0x0008 |
Definition at line 192 of file vsnprintf.c.
Referenced by BSD_vfprintf(), rb_enc_vsprintf(), rb_str_vcatf(), ruby_snprintf(), and ruby_vsnprintf().
| #define _BSD_VA_LIST_ va_list |
Definition at line 88 of file vsnprintf.c.
| #define ALT 0x001 |
Definition at line 523 of file vsnprintf.c.
Referenced by BSD_vfprintf(), and cvt().
| #define BUF (MAXEXP+MAXFRACT+1) |
Definition at line 507 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define clearerr | ( | p | ) | __sclearerr(p) |
Definition at line 219 of file vsnprintf.c.
Referenced by rb_w32_getc().
| #define COPY | ( | n | ) | (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n)) |
Referenced by BSD__sfvwrite().
| #define DEFPREC 6 |
Definition at line 508 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define EOF (-1) |
Definition at line 206 of file vsnprintf.c.
Referenced by appendline(), BSD_vfprintf(), curses_getch(), e_iconv(), e_oconv(), eol_conv(), fold_conv(), h_conv(), j_oconv(), kanji_convert(), mime_begin(), mime_begin_strict(), mime_getc(), mime_integrity(), mime_prechar(), mime_putc(), nfc_getc(), nkf_iconv_utf_16(), nkf_iconv_utf_32(), noconvert(), parser_prepare(), print_guessed_code(), push_hold_buf(), qpencode(), rb_io_getline_1(), rb_w32_getc(), ruby_snprintf(), ruby_vsnprintf(), s_iconv(), s_oconv(), std_putc(), w_iconv(), w_oconv(), w_oconv16(), w_oconv32(), window_getch(), and z_conv().
| #define feof | ( | p | ) | __sfeof(p) |
Definition at line 217 of file vsnprintf.c.
Referenced by rb_vm_bugreport().
| #define ferror | ( | p | ) | __sferror(p) |
Definition at line 218 of file vsnprintf.c.
| #define fileno | ( | p | ) | __sfileno(p) |
Definition at line 222 of file vsnprintf.c.
Referenced by fseeko(), init_stdhandle(), main(), pipe_open(), prep_stdio(), rb_io_initialize(), rb_io_reopen(), rb_read_check(), rb_w32_fclose(), rb_w32_write(), and readline_readline().
| #define FLUSH | ( | ) |
{ \
if (uio.uio_resid && BSD__sprint(fp, &uio)) \
goto error; \
uio.uio_iovcnt = 0; \
iovp = iov; \
}
Referenced by BSD_vfprintf().
| #define FPT 0x100 |
Definition at line 535 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define GETIOV | ( | extra_work | ) |
Referenced by BSD__sfvwrite().
| #define HEXPREFIX 0x002 |
Definition at line 524 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define is_digit | ( | c | ) | ((unsigned)to_digit(c) <= 9) |
Definition at line 357 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define LADJUST 0x004 |
Definition at line 525 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define LONGDBL 0x008 |
Definition at line 526 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define LONGINT 0x010 |
Definition at line 527 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define MAXEXP (DBL_MAX_10_EXP) |
Definition at line 497 of file vsnprintf.c.
Referenced by exponent().
| #define MAXFRACT (MAXEXP*10/3) |
Definition at line 504 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define MIN | ( | a, | |||
| b | ) | ((a) < (b) ? (a) : (b)) |
| #define NIOV 8 |
| #define PAD | ( | howmany, | |||
| with | ) |
{ \
if ((n = (howmany)) > 0) { \
while (n > PADSIZE) { \
PRINT((with), PADSIZE); \
n -= PADSIZE; \
} \
PRINT((with), n); \
} \
}
Referenced by BSD_vfprintf().
| #define PAD_L | ( | howmany, | |||
| with | ) | PAD((howmany), (with)) |
Referenced by BSD_vfprintf().
| #define PADSIZE 16 |
Referenced by BSD_vfprintf().
| #define PRINT | ( | ptr, | |||
| len | ) |
{ \
iovp->iov_base = (ptr); \
iovp->iov_len = (len); \
uio.uio_resid += (len); \
iovp++; \
if (++uio.uio_iovcnt >= NIOV) { \
if (BSD__sprint(fp, &uio)) \
goto error; \
iovp = iov; \
} \
}
| #define SARG | ( | ) |
(flags&LONGINT ? va_arg(ap, long) : \ flags&SHORTINT ? (long)(short)va_arg(ap, int) : \ (long)va_arg(ap, int))
Referenced by BSD_vfprintf().
| #define SHORTINT 0x040 |
Definition at line 533 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define to_char | ( | n | ) | (char)((n) + '0') |
Definition at line 358 of file vsnprintf.c.
Referenced by BSD__ultoa(), and exponent().
| #define to_digit | ( | c | ) | ((c) - '0') |
Definition at line 356 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| #define u_int unsigned int |
Definition at line 66 of file vsnprintf.c.
| #define u_long unsigned long |
Definition at line 64 of file vsnprintf.c.
Referenced by BSD_vfprintf(), fcntl(), getaddrinfo(), and getnameinfo().
| #define u_short unsigned short |
Definition at line 65 of file vsnprintf.c.
Referenced by get_addr(), get_name(), getaddrinfo(), and getnameinfo().
| #define UARG | ( | ) |
| #define UNINITIALIZED_VAR | ( | x | ) | x |
Definition at line 133 of file vsnprintf.c.
| #define ZEROPAD 0x080 |
Definition at line 534 of file vsnprintf.c.
Referenced by BSD_vfprintf().
| char* BSD__dtoa __P | ( | (double, int, int, int *, int *, char **) | ) |
| static int exponent __P | ( | (char *, int, int) | ) | [static] |
| static char* cvt __P | ( | (double, int, int, char *, int *, int, int *, char *) | ) | [static] |
| char* BSD__hdtoa | ( | double | , | |
| const char * | , | |||
| int | , | |||
| int * | , | |||
| int * | , | |||
| char ** | ||||
| ) |
| static int BSD__sbprintf | ( | register FILE * | fp, | |
| const char * | fmt, | |||
| va_list | ap | |||
| ) | [static] |
Definition at line 346 of file vsnprintf.c.
Referenced by BSD_vfprintf().
Definition at line 245 of file vsnprintf.c.
References __SLBF, __SNBF, __SSTR, COPY, GETIOV, __siov::iov_base, __siov::iov_len, and len.
Referenced by ruby_snprintf(), and ruby_vsnprintf().
Definition at line 325 of file vsnprintf.c.
References err, __suio::uio_iovcnt, __suio::uio_resid, and __sFILE::vwrite.
| static char* BSD__ultoa | ( | register u_long | val, | |
| char * | endp, | |||
| int | base, | |||
| int | octzero, | |||
| const char * | xdigs | |||
| ) | [static] |
Definition at line 433 of file vsnprintf.c.
References LONG_MAX, and to_char.
Referenced by BSD_vfprintf().
| static ssize_t BSD_vfprintf | ( | FILE * | fp, | |
| const char * | fmt0, | |||
| va_list | ap | |||
| ) | [static] |
Definition at line 537 of file vsnprintf.c.
References __sferror, __SNBF, __SRW, __SWR, __sFILE::_file, __sFILE::_flags, ALT, BSD__sbprintf(), BSD__ultoa(), BUF, buf, CHAR_BIT, cvt(), DEFPREC, EOF, exponent(), FLUSH, FPT, HEXPREFIX, is_digit, isinf(), isnan, LADJUST, LONGDBL, LONGINT, MAXFRACT, NULL, PAD, PAD_L, PADSIZE, PRINT, SARG, SHORTINT, size, strlen(), to_digit, u_long, UARG, __suio::uio_iov, __suio::uio_iovcnt, __suio::uio_resid, UNINITIALIZED_VAR, and ZEROPAD.
Referenced by rb_enc_vsprintf(), rb_str_vcatf(), ruby_snprintf(), and ruby_vsnprintf().
| static char* cvt | ( | double | value, | |
| int | ndigits, | |||
| int | flags, | |||
| char * | sign, | |||
| int * | decpt, | |||
| int | ch, | |||
| int * | length, | |||
| char * | buf | |||
| ) | [static] |
Definition at line 1187 of file vsnprintf.c.
References ALT, bp, BSD__dtoa, BSD__hdtoa, and xfree.
Referenced by BSD_vfprintf().
| static int exponent | ( | char * | p0, | |
| int | exp, | |||
| int | fmtch | |||
| ) | [static] |
Definition at line 1236 of file vsnprintf.c.
References MAXEXP, and to_char.
Referenced by BSD_vfprintf().
| int ruby_snprintf | ( | char * | str, | |
| size_t | n, | |||
| char const * | fmt, | |||
| ... | ||||
| ) |
Definition at line 1285 of file vsnprintf.c.
References __SSTR, __SWR, __sbuf::_base, __sFILE::_bf, __sFILE::_flags, __sFILE::_p, __sbuf::_size, __sFILE::_w, BSD__sfvwrite(), BSD_vfprintf(), EOF, and __sFILE::vwrite.
| int ruby_vsnprintf | ( | char * | str, | |
| size_t | n, | |||
| const char * | fmt, | |||
| va_list | ap | |||
| ) |
Definition at line 1268 of file vsnprintf.c.
References __SSTR, __SWR, __sbuf::_base, __sFILE::_bf, __sFILE::_flags, __sFILE::_p, __sbuf::_size, __sFILE::_w, BSD__sfvwrite(), BSD_vfprintf(), EOF, and __sFILE::vwrite.
1.6.1