![]() |
SyterKit 0.4.0.x
SyterKit is a bare-metal framework
|
#include "xformat.h"
Classes | |
| struct | param_s |
| Structure with all parameter used. More... | |
Macros | |
| #define | LONG long |
| Default largest int is long. | |
| #define | DOUBLE double |
| Define the double type if not defined. | |
| #define | LONGLONG long long |
| Default long long type. | |
| #define | FLOAT_LONG LONG |
| Definition to convert integer part of floating point numer if supported we use the long long type. | |
| #define | FLOAT_VALUE lvalue |
| #define | FLOAT_TYPE FLAG_TYPE_LONG |
| #define | FLAG_TYPE_INT 0x0000 /* Argument is integer */ |
| #define | FLAG_TYPE_LONG 0x0001 /* Argument is long */ |
| #define | FLAG_TYPE_SIZEOF 0x0002 /* Argument is size_t */ |
| #define | FLAG_TYPE_LONGLONG 0x0003 /* Argument is long long */ |
| #define | FLAG_TYPE_MASK 0x0003 /* Mask for field type */ |
| #define | FLAG_PREC 0x0004 /* Precision set */ |
| #define | FLAG_LEFT 0x0008 /* Left alignment */ |
| #define | FLAG_BLANK 0x0010 /* Blank before positive integer number */ |
| #define | FLAG_PREFIX 0x0020 /* Prefix required */ |
| #define | FLAG_PLUS 0x0040 /* Force a + before positive number */ |
| #define | FLAG_UPPER 0x0080 /* Output in upper case letter */ |
| #define | FLAG_DECIMAL 0x0100 /* Decimal field */ |
| #define | FLAG_INTEGER 0x0200 /* Integer field */ |
| #define | FLAG_MINUS 0x0400 /* Field is negative */ |
| #define | FLAG_VALUE 0x0800 /* Value set */ |
| #define | FLAG_BUFFER 0x1000 /* Buffer set */ |
| #define | args _args |
Enumerations | |
| enum | State { ST_NORMAL = 0 , ST_PERCENT = 1 , ST_FLAG = 2 , ST_WIDTH = 3 , ST_DOT = 4 , ST_PRECIS = 5 , ST_SIZE = 6 , ST_TYPE = 7 } |
| Enum for the internal state machine. More... | |
| enum | CharClass { CH_OTHER = 0 , CH_PERCENT = 1 , CH_DOT = 2 , CH_STAR = 3 , CH_ZERO = 4 , CH_DIGIT = 5 , CH_FLAG = 6 , CH_SIZE = 7 , CH_TYPE = 8 } |
| Enum for char class. More... | |
Functions | |
| static void | ulong2a (struct param_s *param) |
| Convert an unsigned value in one string. | |
| unsigned | xformat (void(*outchar)(void *, char), void *arg, const char *fmt,...) |
| Printf like using variable arguments. | |
| static unsigned | xstrlen (const char *s) |
| We do not want use any library function. | |
| static unsigned | outBuffer (void(*myoutchar)(void *arg, char), void *arg, const char *buffer, int len, unsigned toupper) |
| static unsigned | outChars (void(*myoutchar)(void *arg, char), void *arg, char ch, int len) |
| unsigned | xvformat (void(*outchar)(void *, char), void *arg, const char *fmt, va_list _args) |
| Printf like format function. | |
Variables | |
| static const char | ms_null [] = "(null)" |
| String used when s is a null parameter. | |
| static const char | ms_true [] = "True" |
| static const char | ms_false [] = "False" |
| String for false value. | |
| static const char | ms_digits [] = "0123456789abcdef" |
| static const unsigned char | formatStates [] |
| #define args _args |
| #define DOUBLE double |
Define the double type if not defined.
| #define FLAG_BLANK 0x0010 /* Blank before positive integer number */ |
| #define FLAG_BUFFER 0x1000 /* Buffer set */ |
| #define FLAG_DECIMAL 0x0100 /* Decimal field */ |
| #define FLAG_INTEGER 0x0200 /* Integer field */ |
| #define FLAG_LEFT 0x0008 /* Left alignment */ |
| #define FLAG_MINUS 0x0400 /* Field is negative */ |
| #define FLAG_PLUS 0x0040 /* Force a + before positive number */ |
| #define FLAG_PREC 0x0004 /* Precision set */ |
| #define FLAG_PREFIX 0x0020 /* Prefix required */ |
| #define FLAG_TYPE_INT 0x0000 /* Argument is integer */ |
| #define FLAG_TYPE_LONG 0x0001 /* Argument is long */ |
| #define FLAG_TYPE_LONGLONG 0x0003 /* Argument is long long */ |
| #define FLAG_TYPE_MASK 0x0003 /* Mask for field type */ |
| #define FLAG_TYPE_SIZEOF 0x0002 /* Argument is size_t */ |
| #define FLAG_UPPER 0x0080 /* Output in upper case letter */ |
| #define FLAG_VALUE 0x0800 /* Value set */ |
| #define FLOAT_LONG LONG |
Definition to convert integer part of floating point numer if supported we use the long long type.
| #define FLOAT_TYPE FLAG_TYPE_LONG |
| #define FLOAT_VALUE lvalue |
| #define LONG long |
Default largest int is long.
| #define LONGLONG long long |
Default long long type.
| enum CharClass |
| enum State |
|
static |
|
static |
|
static |
Convert an unsigned value in one string.
All parameter are in the passed structure
| prec | - Minimum precision |
| lvalue | - Unsigned value |
| radix | - Radix (Supported values 2/8/10/16) |
| out | - Buffer with the converted value. |
| unsigned xformat | ( | void(*)(void *, char) | outchar, |
| void * | arg, | ||
| const char * | fmt, | ||
| ... | |||
| ) |
Printf like using variable arguments.
| outchar | - Pointer to the function to output one new char. |
| arg | - Argument for the output function. |
| fmt | - Format options for the list of parameters. |
| ... | - Arguments |
|
static |
We do not want use any library function.
| s | - C string |
| unsigned xvformat | ( | void(*)(void *, char) | outchar, |
| void * | arg, | ||
| const char * | fmt, | ||
| va_list | _args | ||
| ) |
Printf like format function.
General format :
%[width][.precision][flags]type
Supported flags :
Supported type :
| outchar | - Pointer to the function to output one char. |
| arg | - Argument for the output function. |
| fmt | - Format options for the list of parameters. |
| args | -List parameters. |
|
static |
|
static |
|
static |
String for false value.
|
static |
String used when s is a null parameter.
|
static |