Strophe 0.13
XMPP client library
snprintf.c File Reference

A snprintf implementation. More...

Macros

#define VA_LOCAL_DECL   va_list ap
 
#define VA_START(f)
 
#define VA_END   va_end(ap)
 
#define LDOUBLE   double
 
#define DP_S_DEFAULT   0
 
#define DP_S_FLAGS   1
 
#define DP_S_MIN   2
 
#define DP_S_DOT   3
 
#define DP_S_MAX   4
 
#define DP_S_MOD   5
 
#define DP_S_CONV   6
 
#define DP_S_DONE   7
 
#define DP_F_MINUS   (1 << 0)
 
#define DP_F_PLUS   (1 << 1)
 
#define DP_F_SPACE   (1 << 2)
 
#define DP_F_NUM   (1 << 3)
 
#define DP_F_ZERO   (1 << 4)
 
#define DP_F_UP   (1 << 5)
 
#define DP_F_UNSIGNED   (1 << 6)
 
#define DP_C_SHORT   1
 
#define DP_C_LONG   2
 
#define DP_C_LDOUBLE   3
 
#define char_to_int(p)
 
#define MAX(p, q)
 
#define MIN(p, q)
 

Functions

static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
 
static int fmtstr (char *buffer, size_t *currlen, size_t maxlen, char *value, int flags, int min, int max)
 
static int fmtint (char *buffer, size_t *currlen, size_t maxlen, long value, int base, int min, int max, int flags)
 
static int fmtfp (char *buffer, size_t *currlen, size_t maxlen, LDOUBLE fvalue, int min, int max, int flags)
 
static int dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c)
 
static LDOUBLE abs_val (LDOUBLE value)
 
static LDOUBLE _snp_pow10 (int exp)
 
static long _snp_round (LDOUBLE value)
 
int strophe_vsnprintf (char *str, size_t count, const char *fmt, va_list args)
 
int strophe_snprintf (char *str, size_t count, const char *fmt,...)
 

Detailed Description

A snprintf implementation.

Macro Definition Documentation

◆ VA_LOCAL_DECL

#define VA_LOCAL_DECL   va_list ap

◆ VA_START

#define VA_START ( f)
Value:
va_start(ap, f)

◆ VA_END

#define VA_END   va_end(ap)

◆ LDOUBLE

#define LDOUBLE   double

◆ DP_S_DEFAULT

#define DP_S_DEFAULT   0

◆ DP_S_FLAGS

#define DP_S_FLAGS   1

◆ DP_S_MIN

#define DP_S_MIN   2

◆ DP_S_DOT

#define DP_S_DOT   3

◆ DP_S_MAX

#define DP_S_MAX   4

◆ DP_S_MOD

#define DP_S_MOD   5

◆ DP_S_CONV

#define DP_S_CONV   6

◆ DP_S_DONE

#define DP_S_DONE   7

◆ DP_F_MINUS

#define DP_F_MINUS   (1 << 0)

◆ DP_F_PLUS

#define DP_F_PLUS   (1 << 1)

◆ DP_F_SPACE

#define DP_F_SPACE   (1 << 2)

◆ DP_F_NUM

#define DP_F_NUM   (1 << 3)

◆ DP_F_ZERO

#define DP_F_ZERO   (1 << 4)

◆ DP_F_UP

#define DP_F_UP   (1 << 5)

◆ DP_F_UNSIGNED

#define DP_F_UNSIGNED   (1 << 6)

◆ DP_C_SHORT

#define DP_C_SHORT   1

◆ DP_C_LONG

#define DP_C_LONG   2

◆ DP_C_LDOUBLE

#define DP_C_LDOUBLE   3

◆ char_to_int

#define char_to_int ( p)
Value:
(p - '0')

◆ MAX

#define MAX ( p,
q )
Value:
((p >= q) ? p : q)

◆ MIN

#define MIN ( p,
q )
Value:
((p <= q) ? p : q)

Function Documentation

◆ dopr()

static int dopr ( char * buffer,
size_t maxlen,
const char * format,
va_list args )
static

◆ fmtstr()

static int fmtstr ( char * buffer,
size_t * currlen,
size_t maxlen,
char * value,
int flags,
int min,
int max )
static

◆ fmtint()

static int fmtint ( char * buffer,
size_t * currlen,
size_t maxlen,
long value,
int base,
int min,
int max,
int flags )
static

◆ fmtfp()

static int fmtfp ( char * buffer,
size_t * currlen,
size_t maxlen,
LDOUBLE fvalue,
int min,
int max,
int flags )
static

◆ dopr_outch()

static int dopr_outch ( char * buffer,
size_t * currlen,
size_t maxlen,
char c )
static

◆ abs_val()

static LDOUBLE abs_val ( LDOUBLE value)
static

◆ _snp_pow10()

static LDOUBLE _snp_pow10 ( int exp)
static

◆ _snp_round()

static long _snp_round ( LDOUBLE value)
static

◆ strophe_vsnprintf()

int strophe_vsnprintf ( char * str,
size_t count,
const char * fmt,
va_list args )

◆ strophe_snprintf()

int strophe_snprintf ( char * str,
size_t count,
const char * fmt,
... )