diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-03-06 12:55:52 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-03-06 12:55:52 +0300 |
commit | 6121968b198dcbb93427b0a11453563ebe462bb4 (patch) | |
tree | 1b612b73db2b4572c591bf8644021b2407a8f602 /newlib/libc/stdio/local.h | |
parent | 6e0e5a4fc20a1de8124c454a5c14c616c68e4653 (diff) |
* libc/include/stdio.h (__VALIST): Guard against multiple definition.
* libc/include/wchar.h: Include stdarg.h.
(__VALIST): Define conditionally.
(fwprintf, swprintf, vfwprintf, vswprintf, vwprintf, wprintf: Declare.
(_fwprintf_r, _swprintf_r, _vfwprintf_r, _vswprintf_r, _vwprintf_r,
_wprintf_r): Declare.
* libc/stdio/Makefile.am: Add new files.
* libc/stdio/Makefile.in: Regenerate.
* libc/stdio/fwprintf.c: New file.
* libc/stdio/local.h (_svfwprintf_r, _svfiwprintf_r): Declare.
(__CH_CLASS, __STATE, __ACTION): Move definition from vfprintf.c here
and move to the __ namespace.
(__chclass, __state_table, __action_table): Declare.
* libc/stdio/stdio.tex: Add new documentation references.
* libc/stdio/swprintf.c: New file.
* libc/stdio/vfprintf.c (__SPRINT): New macro to call the right
__sprint_r function according to compilation unit. Use throughout.
(__ssprint_r): Rename STRING_ONLY variant from __sprint_r.
Make externaly available. Only define if INTEGER_ONLY is defined.
(__sprint_r): Make externaly available. Only define if INTEGER_ONLY
is defined. Handle stream orientation.
(__sbprintf): Copy FILE's _flags2 member as well.
(__chclass, __state_table, __action_table): Prepend __ to name and
make externally available.
* libc/stdio/vfwprintf.c: New file.
* libc/stdio/vswprintf.c: New file.
* libc/stdio/vwprintf.c: New file.
* libc/stdio/wprintf.c: New file.
Diffstat (limited to 'newlib/libc/stdio/local.h')
-rw-r--r-- | newlib/libc/stdio/local.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 29e7cc6c1..1e1e042d2 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -44,6 +44,10 @@ int _EXFUN(_svfprintf_r,(struct _reent *, FILE *, const char *, int _EXFUN(_svfiprintf_r,(struct _reent *, FILE *, const char *, va_list) _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); +int _EXFUN(_svfwprintf_r,(struct _reent *, FILE *, const wchar_t *, + va_list)); +int _EXFUN(_svfiwprintf_r,(struct _reent *, FILE *, const wchar_t *, + va_list)); extern FILE *_EXFUN(__sfp,(struct _reent *)); extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*)); extern int _EXFUN(__srefill_r,(struct _reent *,FILE *)); @@ -167,3 +171,51 @@ _VOID _EXFUN(__sfp_lock_release,(_VOID)); _VOID _EXFUN(__sinit_lock_acquire,(_VOID)); _VOID _EXFUN(__sinit_lock_release,(_VOID)); #endif + +/* Types used in positional argument support in vfprinf/vfwprintf. + The implementation is char/wchar_t dependent but the class and state + tables are only defined once in vfprintf.c. */ +typedef enum { + ZERO, /* '0' */ + DIGIT, /* '1-9' */ + DOLLAR, /* '$' */ + MODFR, /* spec modifier */ + SPEC, /* format specifier */ + DOT, /* '.' */ + STAR, /* '*' */ + FLAG, /* format flag */ + OTHER, /* all other chars */ + MAX_CH_CLASS /* place-holder */ +} __CH_CLASS; + +typedef enum { + START, /* start */ + SFLAG, /* seen a flag */ + WDIG, /* seen digits in width area */ + WIDTH, /* processed width */ + SMOD, /* seen spec modifier */ + SDOT, /* seen dot */ + VARW, /* have variable width specifier */ + VARP, /* have variable precision specifier */ + PREC, /* processed precision */ + VWDIG, /* have digits in variable width specification */ + VPDIG, /* have digits in variable precision specification */ + DONE, /* done */ + MAX_STATE, /* place-holder */ +} __STATE; + +typedef enum { + NOOP, /* do nothing */ + NUMBER, /* build a number from digits */ + SKIPNUM, /* skip over digits */ + GETMOD, /* get and process format modifier */ + GETARG, /* get and process argument */ + GETPW, /* get variable precision or width */ + GETPWB, /* get variable precision or width and pushback fmt char */ + GETPOS, /* get positional parameter value */ + PWPOS, /* get positional parameter value for variable width or precision */ +} __ACTION; + +_CONST __CH_CLASS __chclass[256]; +_CONST __STATE __state_table[MAX_STATE][MAX_CH_CLASS]; +_CONST __ACTION __action_table[MAX_STATE][MAX_CH_CLASS]; |