This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] New functions wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf


Corinna Vinschen wrote:
Hi,

attached inline is a patch which adds the wprintf family of functions
according to the POSIX-1.2008 definition.

Basically the functions are copied from their non-w counterparts.
However, there's one big change.  So far there were multiple versions of
the __sprint_r functions defined.  Since these functions can be shared
between all versions of vfprintf/vfwprintf, and since especially the
STRING_ONLY variant of these functions is not that small, I made an
additional effort to have only one __sprint_r function and only one
__ssprint_r function, the latter being the STRING_ONLY version.  Using
different names was necessary because the functions are naturally not
static anymore.

The handling of the s, ls, c, lc format specifier follows exactly the
POSIX-1.2008 definition.

Of course I tested this new functionality on Cygwin.  Having said that,
I would very much appreciate if other people on this list would give
this functionality some additional testing.  printf is such a complex
function, I could hardly test it all.

Hi Corinna,

Thanks for doing this. Please feel free to check it in.

-- Jeff J.
wscanf anybody?


Corinna



* libc/include/stdio.h (__VALIST): Guard against multiple definition. * libc/include/wchar.h: Include stdarg.h. (__VALIST): Define conditionally. (fwprintf): Declare. (swprintf): Declare. (vfwprintf): Declare. (vswprintf): Declare. (vwprintf): Declare. (wprintf): Declare. (_fwprintf_r): Declare. (_swprintf_r): Declare. (_vfwprintf_r): Declare. (_vswprintf_r): Declare. (_vwprintf_r): Declare. (_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): Declare. (_svfiwprintf_r): 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. * libc/stdio/vfwprintf.c: New file. * libc/stdio/vswprintf.c: New file. * libc/stdio/vwprintf.c: New file. * libc/stdio/wprintf.c: New file.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]