MicrOS
vfprintf.c File Reference
#include <stdarg.h>
#include "../stdlib.h"
#include "../string.h"
#include "../math.h"
#include "../stdio.h"

Macros

#define FLAGS_ZEROPAD   (1U << 0U)
 
#define FLAGS_LEFT   (1U << 1U)
 
#define FLAGS_PLUS   (1U << 2U)
 
#define FLAGS_SPACE   (1U << 3U)
 
#define FLAGS_HASH   (1U << 4U)
 
#define FLAGS_UPPERCASE   (1U << 5U)
 
#define FLAGS_CHAR   (1U << 6U)
 
#define FLAGS_SHORT   (1U << 7U)
 
#define FLAGS_LONG   (1U << 8U)
 
#define FLAGS_LONG_LONG   (1U << 9U)
 
#define FLAGS_PRECISION   (1U << 10U)
 
#define FLAGS_LONG_DOUBLE   (1U << 11U)
 

Typedefs

typedef long long int i64
 
typedef unsigned long long int u64
 

Functions

bool _is_digit (char c)
 
int _max (int a, int b)
 
unsigned int _unsigned_number_len (u64 n, int base)
 
unsigned int _fnumber_len (long double n)
 
char * _itoa (u64 number, char *buffer, int base, bool uppercase, int size)
 
char * _ftoa (long double number, char *buffer, unsigned short flags, int precision)
 
void _put_unsigned_integer (FILE *stream, unsigned int *put_idx, u64 number, unsigned short flags, int base, int width, int precision)
 
void _put_signed_integer (FILE *stream, unsigned int *put_idx, i64 number, unsigned short flags, int base, int width, int precision)
 
void _put_float (FILE *stream, unsigned int *put_idx, long double number, unsigned short flags, int width, int precision)
 
void _put_scientific_notation (FILE *stream, unsigned int *put_idx, long double number, unsigned short flags, int width, int precision)
 
unsigned int _parse_number_field (const char **str)
 
int vfprintf (FILE *stream, const char *format, va_list arg)
 Print formatted data from variable argument list to stream. More...
 

Macro Definition Documentation

◆ FLAGS_CHAR

#define FLAGS_CHAR   (1U << 6U)

◆ FLAGS_HASH

#define FLAGS_HASH   (1U << 4U)

◆ FLAGS_LEFT

#define FLAGS_LEFT   (1U << 1U)

◆ FLAGS_LONG

#define FLAGS_LONG   (1U << 8U)

◆ FLAGS_LONG_DOUBLE

#define FLAGS_LONG_DOUBLE   (1U << 11U)

◆ FLAGS_LONG_LONG

#define FLAGS_LONG_LONG   (1U << 9U)

◆ FLAGS_PLUS

#define FLAGS_PLUS   (1U << 2U)

◆ FLAGS_PRECISION

#define FLAGS_PRECISION   (1U << 10U)

◆ FLAGS_SHORT

#define FLAGS_SHORT   (1U << 7U)

◆ FLAGS_SPACE

#define FLAGS_SPACE   (1U << 3U)

◆ FLAGS_UPPERCASE

#define FLAGS_UPPERCASE   (1U << 5U)

◆ FLAGS_ZEROPAD

#define FLAGS_ZEROPAD   (1U << 0U)

Typedef Documentation

◆ i64

typedef long long int i64

◆ u64

typedef unsigned long long int u64

Function Documentation

◆ _fnumber_len()

unsigned int _fnumber_len ( long double  n)

◆ _ftoa()

char* _ftoa ( long double  number,
char *  buffer,
unsigned short  flags,
int  precision 
)

◆ _is_digit()

bool _is_digit ( char  c)

◆ _itoa()

char* _itoa ( u64  number,
char *  buffer,
int  base,
bool  uppercase,
int  size 
)

◆ _max()

int _max ( int  a,
int  b 
)

◆ _parse_number_field()

unsigned int _parse_number_field ( const char **  str)

◆ _put_float()

void _put_float ( FILE stream,
unsigned int *  put_idx,
long double  number,
unsigned short  flags,
int  width,
int  precision 
)

◆ _put_scientific_notation()

void _put_scientific_notation ( FILE stream,
unsigned int *  put_idx,
long double  number,
unsigned short  flags,
int  width,
int  precision 
)

◆ _put_signed_integer()

void _put_signed_integer ( FILE stream,
unsigned int *  put_idx,
i64  number,
unsigned short  flags,
int  base,
int  width,
int  precision 
)

◆ _put_unsigned_integer()

void _put_unsigned_integer ( FILE stream,
unsigned int *  put_idx,
u64  number,
unsigned short  flags,
int  base,
int  width,
int  precision 
)

◆ _unsigned_number_len()

unsigned int _unsigned_number_len ( u64  n,
int  base 
)

◆ vfprintf()

int vfprintf ( FILE stream,
const char *  format,
va_list  arg 
)

Print formatted data from variable argument list to stream.

Writes the C string pointed by format to the stream. If format includes format specifiers (subsequences beginning with %), the additional arguments stored in arg list are formatted and inserted in the resulting string replacing their respective specifiers.

Parameters
streamPointer to a FILE object that identifies an output stream.
formatC string that contains the text to be written to the stream.Can contain embedded format specifiers.
argA value identifying a variable arguments list initialized with va_start.
Returns
Total number of characters written to stream.