implement asnprintf, take 2
Jeff Johnston
jjohnstn@redhat.com
Mon Apr 30 22:12:00 GMT 2007
Hi Eric,
I'm not seeing an explanation for the following code change you have
made in vfprintf.c:
@@ -1247,13 +1201,13 @@ number: if ((dprec = prec) >= 0)
if (_fpvalue == 0) {
/* kludge for __dtoa
irregularity */
PRINT ("0", 1);
- if (expt < ndig || (flags & ALT)
!= 0) {
+ if (ndig || flags & ALT) {
PRINT (decimal_point, 1);
PAD (ndig - 1, zeroes);
}
Note the check expt < ndig has been replaced with ndig.
-- Jeff J.
Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to Jeff Johnston on 4/24/2007 1:03 PM:
>> Eric,
>>
>> A number of issues regarding ELIX_LEVEL. These new functions should be
>> level 4. That means you need a new set of ELIX_4_SOURCES and you simply
>> verify that the level is not 1, 2, or 3. Add ELIX_4_SOURCES to the list
>> of sources below. Very straightforward.
>>
>> This patch has revealed an error I hadn't spotted before. The dprintf
>> family cannot refer to a higher level ELIX function so they must be put
>> into the LEVEL 2 sources with asprintf, etc..
>>
>> Finally, the dprintf changes you have made need to either be left out
>> or you need to fork the code based on the ELIX level and call the new
>> LEVEL 4 functions when the _ELIX_LEVEL flag is undefined or >3.
>
> This version is a bit bigger, because it also improves the documentation
> (let me know if I need to split it into two independent patches). I went
> ahead and documented %a, even though it is not implemented yet (I'm still
> working on that). This version also fixes Makefile.am to put dprintf and
> asnprintf in ELIX_4_SOURCES. I've tested that cygwin can still be built
> with this patch.
>
> 2007-04-28 Eric Blake <ebb9@byu.net>
>
> Add support for asnprintf, and improve *printf documentation.
> * libc/stdio/Makefile.am (ELIX_SOURCES): Rename...
> (ELIX_2_SOURCES): ...to this.
> (ELIX_4_SOURCES): Add new variable. Build asnprintf.
> (GENERAL_SOURCES): Move dprintf to ELIX_4_SOURCES.
> (CHEWOUT_FILES): Include diprintf in documentation.
> * libc/stdio/diprintf.c: Improve documentation.
> * libc/stdio/dprintf.c: Likewise.
> * libc/stdio/siprintf.c: Likewise.
> * libc/stdio/sprintf.c: Likewise.
> * libc/stdio/vfprintf.c: Likewise.
> * libc/stdio/viprintf.c: Likewise.
> * libc/stdio/vsniprintf.c: Consolidate documentation.
> * libc/stdio/asiprintf.c: Refer to documentation.
> * libc/stdio/asprintf.c: Likewise.
> * libc/stdio/fiprintf.c: Likewise.
> * libc/stdio/fprintf.c: Likewise.
> * libc/stdio/iprintf.c: Likewise.
> * libc/stdio/printf.c: Likewise.
> * libc/stdio/sniprintf.c: Likewise.
> * libc/stdio/vdiprintf.c: Likewise.
> * libc/stdio/vdprintf.c: Likewise.
> * libc/stdio/vsiprintf.c: Likewise.
> * libc/stdio/fvwrite.c (__sfvwrite_r): Handle asnprintf.
> * libc/stdio/asniprintf.c (asniprintf, _asniprintf_r): New file.
> * libc/stdio/asnprintf.c (asnprintf, _asnprintf_r): New file.
> * libc/stdio/vasniprintf.c (vasniprintf, _vasniprintf_r): New
> file.
> * libc/stdio/vasnprintf.c (vasnprintf, _vasnprintf_r): New file.
> * libc/stdio/vdprintf.c (_vdprintf_r): Rewrite to avoid malloc in
> typical case.
> * libc/stdio/vdiprintf.c (_vdiprintf_r): Likewise.
> * libc/include/stdio.h: Add prototypes for new functions; sort
> existing functions.
>
> - --
More information about the Newlib
mailing list