formatwr.c File Reference
Basic "printf", "sprintf" and "fprintf" formatter. More...
#include "formatwr.h"
#include "cfg/cfg_formatwr.h"
#include <cfg/debug.h>
#include <cpu/pgm.h>
#include <mware/hex.h>
Go to the source code of this file.
Defines | |
| #define | CONFIG_PRINTF_N_FORMATTER 0 |
| Disable the arcane n formatter. | |
| #define | CONFIG_PRINTF_OCTAL_FORMATTER 0 |
| Disable the o formatter. | |
Detailed Description
Basic "printf", "sprintf" and "fprintf" formatter.
- Version:
- Id
- formatwr.c 2965 2009-09-18 09:35:40Z lottaviano
This module is 100% reentrant and can be adapted to user-defined routines that needs formatters with special properties like different output channels or new format specifiers.
To reduce size in applications not using real numbers or long integers the formatter may be compiled to exclude certain parts. This is controlled by giving a -D option a compilation time:
-D CONFIG_PRINTF=PRINTF_FULL Full ANSI printf formatter, with some C99 extensions -D CONFIG_PRINTF=PRINTF_NOFLOAT Exclude support for floats -D CONFIG_PRINTF=PRINTF_REDUCED Simplified formatter (see below) -D CONFIG_PRINTF=PRINTF_NOMODIFIERS Exclude "l", "z" and "h" modifiers in reduced version -D CONFIG_PRINTF=PRINTF_DISABLED No formatter at all
Code size on AVR4 with GCC 3.4.1 (-O2):
- PRINTF_FULL 2912byte (0xB60)
- PRINTF_NOFLOAT 1684byte (0x694)
- PRINTF_REDUCED 924byte (0x39C)
- PRINTF_NOMODIFIERS 416byte (0x1A0)
- PRINTF_FULL 1493/45
- PRINTF_NOFLOAT 795/45
- PRINTF_REDUCED 482/0
- PRINTF_NOMODIFIERS 301/0
The only formatting specifiers supported by the reduced formatter are:
%% %c %s %d %o %x %X and %hd %ho %hx %hX %ld %lo %lx %lX
It means that real variables are not supported as well as field width and precision arguments.
Definition in file formatwr.c.
Define Documentation
| #define CONFIG_PRINTF_N_FORMATTER 0 |
| #define CONFIG_PRINTF_OCTAL_FORMATTER 0 |
