All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
snprintf.h File Reference
#include <varargs.h>
#include <stdlib.h>
#include <ctype.h>
+ Include dependency graph for snprintf.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DATA
 

Macros

#define DEF_PREC(p)
 
#define dtoa(n, p, f)   numtoa(n, 10, p, f)
 
#define FOUND   1
 
#define htoa(n)   numtoa(n, 16, 0, (char **)0)
 
#define isflag(c)
 
#define itoa(n)   numtoa(n, 10, 0, (char **)0)
 
#define LEFT   0
 
#define LONG_DOUBLE   long double
 
#define LONG_LONG   long long
 
#define MAX_FIELD   15
 
#define MAX_FRACT   29 + 1
 
#define MAX_INT   99 + 1 /* 1 for the null */
 
#define NOT_FOUND   -1
 
#define otoa(n)   numtoa(n, 8, 0, (char **)0)
 
#define PAD_LEFT(p)
 
#define PAD_RIGHT(p)
 
#define PRIVATE   static
 
#define PUBLIC
 
#define PUT_CHAR(c, p)
 
#define PUT_PLUS(d, p)
 
#define PUT_SPACE(d, p)
 
#define RIGHT   1
 
#define ROUND(d, p)
 
#define STAR_ARGS(p)
 
#define SWAP_INT(a, b)   {int t; t = (a); (a) = (b); (b) = t;}
 

Functions

PRIVATE void conv_flag ()
 
PRIVATE void decimal ()
 
PRIVATE void exponent ()
 
PRIVATE void floating ()
 
PRIVATE void hexa ()
 
PRIVATE double integral ()
 
PRIVATE int log_10 ()
 
PRIVATE char * numtoa ()
 
PRIVATE void octal ()
 
PRIVATE double pow_10 ()
 
PRIVATE void strings ()
 

Data Structure Documentation

struct DATA

Definition at line 111 of file snprintf.h.

Data Fields
int a_long
int a_longlong
int counter
char * holder
int justify
int length
char pad
char * pf
int precision
int space
int square
int star_p
int star_w
int width

Macro Definition Documentation

#define DEF_PREC (   p)
Value:
if ((p)->precision == NOT_FOUND) \
(p)->precision = 6
#define NOT_FOUND
Definition: snprintf.h:165

Definition at line 182 of file snprintf.h.

#define dtoa (   n,
  p,
 
)    numtoa(n, 10, p, f)

Definition at line 106 of file snprintf.h.

#define FOUND   1

Definition at line 166 of file snprintf.h.

#define htoa (   n)    numtoa(n, 16, 0, (char **)0)

Definition at line 105 of file snprintf.h.

#define isflag (   c)
Value:
((c) == '#' || (c) == ' ' || \
(c) == '*' || (c) == '+' || \
(c) == '-' || (c) == '.' || \
isdigit(c))

Definition at line 170 of file snprintf.h.

#define itoa (   n)    numtoa(n, 10, 0, (char **)0)

Definition at line 103 of file snprintf.h.

#define LEFT   0

Definition at line 164 of file snprintf.h.

#define LONG_DOUBLE   long double

Definition at line 95 of file snprintf.h.

#define LONG_LONG   long long

Definition at line 87 of file snprintf.h.

#define MAX_FIELD   15

Definition at line 167 of file snprintf.h.

#define MAX_FRACT   29 + 1

Definition at line 81 of file snprintf.h.

#define MAX_INT   99 + 1 /* 1 for the null */

Definition at line 80 of file snprintf.h.

#define NOT_FOUND   -1

Definition at line 165 of file snprintf.h.

#define otoa (   n)    numtoa(n, 8, 0, (char **)0)

Definition at line 104 of file snprintf.h.

#define PAD_LEFT (   p)
Value:
if ((p)->width > 0 && (p)->justify == LEFT) \
for (; (p)->width > 0; (p)->width--) \
PUT_CHAR((p)->pad, p)
#define LEFT
Definition: snprintf.h:164
#define PUT_CHAR(c, p)
Definition: snprintf.h:187

Definition at line 208 of file snprintf.h.

#define PAD_RIGHT (   p)
Value:
if ((p)->width > 0 && (p)->justify != LEFT) \
for (; (p)->width > 0; (p)->width--) \
PUT_CHAR((p)->pad, p)
#define LEFT
Definition: snprintf.h:164
#define PUT_CHAR(c, p)
Definition: snprintf.h:187

Definition at line 202 of file snprintf.h.

#define PRIVATE   static

Definition at line 51 of file snprintf.h.

#define PUBLIC

Definition at line 52 of file snprintf.h.

#define PUT_CHAR (   c,
 
)
Value:
if ((p)->counter < (p)->length) { \
*(p)->holder++ = (c); \
(p)->counter++; \
}
uint8_t length
Definition: proto_bfd.c:203

Definition at line 187 of file snprintf.h.

#define PUT_PLUS (   d,
 
)
Value:
if ((d) > 0. && (p)->justify == RIGHT) \
PUT_CHAR('+', p)
#define PUT_CHAR(c, p)
Definition: snprintf.h:187
#define RIGHT
Definition: snprintf.h:163

Definition at line 193 of file snprintf.h.

#define PUT_SPACE (   d,
 
)
Value:
if ((p)->space == FOUND && (d) > 0.) \
PUT_CHAR(' ', p)
#define PUT_CHAR(c, p)
Definition: snprintf.h:187
#define FOUND
Definition: snprintf.h:166

Definition at line 197 of file snprintf.h.

#define RIGHT   1

Definition at line 163 of file snprintf.h.

#define ROUND (   d,
 
)
Value:
(d < 0.) ? \
d - pow_10(-(p)->precision) * 0.5 : \
d + pow_10(-(p)->precision) * 0.5
PRIVATE double pow_10()

Definition at line 176 of file snprintf.h.

#define STAR_ARGS (   p)
Value:
if ((p)->star_w == FOUND) \
(p)->width = va_arg(args, int); \
if ((p)->star_p == FOUND) \
(p)->precision = va_arg(args, int)
#define FOUND
Definition: snprintf.h:166

Definition at line 214 of file snprintf.h.

#define SWAP_INT (   a,
 
)    {int t; t = (a); (a) = (b); (b) = t;}

Definition at line 108 of file snprintf.h.

Function Documentation

PRIVATE void conv_flag ( )
PRIVATE void decimal ( )
PRIVATE void exponent ( )
PRIVATE void floating ( )
PRIVATE void hexa ( )
PRIVATE double integral ( )
PRIVATE int log_10 ( )
PRIVATE char* numtoa ( )
PRIVATE void octal ( )
PRIVATE double pow_10 ( )
PRIVATE void strings ( )