mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Getting ready for the 1.192 release.
- Floating point output in hexadecimal notation can now show a sign in front of the hex prefix string. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14945 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 191
|
#define REVISION 192
|
||||||
#define DATE "9.4.2005"
|
#define DATE "12.5.2005"
|
||||||
#define VERS "amiga.lib 1.191"
|
#define VERS "amiga.lib 1.192"
|
||||||
#define VSTRING "amiga.lib 1.191 (9.4.2005)\r\n"
|
#define VSTRING "amiga.lib 1.192 (12.5.2005)\r\n"
|
||||||
#define VERSTAG "\0$VER: amiga.lib 1.191 (9.4.2005)"
|
#define VERSTAG "\0$VER: amiga.lib 1.192 (12.5.2005)"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
191
|
192
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 191
|
#define REVISION 192
|
||||||
#define DATE "9.4.2005"
|
#define DATE "12.5.2005"
|
||||||
#define VERS "c.lib 1.191"
|
#define VERS "c.lib 1.192"
|
||||||
#define VSTRING "c.lib 1.191 (9.4.2005)\r\n"
|
#define VSTRING "c.lib 1.192 (12.5.2005)\r\n"
|
||||||
#define VERSTAG "\0$VER: c.lib 1.191 (9.4.2005)"
|
#define VERSTAG "\0$VER: c.lib 1.192 (12.5.2005)"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
191
|
192
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
c.lib 1.192 (12.5.2005)
|
||||||
|
|
||||||
- Changed how errors are detected, as returned by Write(), Read() and
|
- Changed how errors are detected, as returned by Write(), Read() and
|
||||||
Seek(). Seek() is particularly challenging because the value it
|
Seek(). Seek() is particularly challenging because the value it
|
||||||
returns might be a valid file position and not an error.
|
returns might be a valid file position and not an error.
|
||||||
@ -87,6 +89,11 @@
|
|||||||
- fflush() now consistently supports a NULL parameter, causing all
|
- fflush() now consistently supports a NULL parameter, causing all
|
||||||
streams to be flushed for which this behaviour is defined.
|
streams to be flushed for which this behaviour is defined.
|
||||||
|
|
||||||
|
- The printf() family can now produce output for floating point
|
||||||
|
numbers with more than about 77 characters, provided sufficient
|
||||||
|
memory is available. C99 calls for a minimum of 4095 characters,
|
||||||
|
but we're trying to allocate the space required dynamically.
|
||||||
|
|
||||||
|
|
||||||
c.lib 1.191 (9.4.2005)
|
c.lib 1.191 (9.4.2005)
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 191
|
#define REVISION 192
|
||||||
#define DATE "9.4.2005"
|
#define DATE "12.5.2005"
|
||||||
#define VERS "debug.lib 1.191"
|
#define VERS "debug.lib 1.192"
|
||||||
#define VSTRING "debug.lib 1.191 (9.4.2005)\r\n"
|
#define VSTRING "debug.lib 1.192 (12.5.2005)\r\n"
|
||||||
#define VERSTAG "\0$VER: debug.lib 1.191 (9.4.2005)"
|
#define VERSTAG "\0$VER: debug.lib 1.192 (12.5.2005)"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
191
|
192
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 191
|
#define REVISION 192
|
||||||
#define DATE "9.4.2005"
|
#define DATE "12.5.2005"
|
||||||
#define VERS "m.lib 1.191"
|
#define VERS "m.lib 1.192"
|
||||||
#define VSTRING "m.lib 1.191 (9.4.2005)\r\n"
|
#define VSTRING "m.lib 1.192 (12.5.2005)\r\n"
|
||||||
#define VERSTAG "\0$VER: m.lib 1.191 (9.4.2005)"
|
#define VERSTAG "\0$VER: m.lib 1.192 (12.5.2005)"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
191
|
192
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 191
|
#define REVISION 192
|
||||||
#define DATE "9.4.2005"
|
#define DATE "12.5.2005"
|
||||||
#define VERS "m881.lib 1.191"
|
#define VERS "m881.lib 1.192"
|
||||||
#define VSTRING "m881.lib 1.191 (9.4.2005)\r\n"
|
#define VSTRING "m881.lib 1.192 (12.5.2005)\r\n"
|
||||||
#define VERSTAG "\0$VER: m881.lib 1.191 (9.4.2005)"
|
#define VERSTAG "\0$VER: m881.lib 1.192 (12.5.2005)"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
191
|
192
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 191
|
#define REVISION 192
|
||||||
#define DATE "9.4.2005"
|
#define DATE "12.5.2005"
|
||||||
#define VERS "net.lib 1.191"
|
#define VERS "net.lib 1.192"
|
||||||
#define VSTRING "net.lib 1.191 (9.4.2005)\r\n"
|
#define VSTRING "net.lib 1.192 (12.5.2005)\r\n"
|
||||||
#define VERSTAG "\0$VER: net.lib 1.191 (9.4.2005)"
|
#define VERSTAG "\0$VER: net.lib 1.192 (12.5.2005)"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
191
|
192
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 191
|
#define REVISION 192
|
||||||
#define DATE "9.4.2005"
|
#define DATE "12.5.2005"
|
||||||
#define VERS "stack.lib 1.191"
|
#define VERS "stack.lib 1.192"
|
||||||
#define VSTRING "stack.lib 1.191 (9.4.2005)\r\n"
|
#define VSTRING "stack.lib 1.192 (12.5.2005)\r\n"
|
||||||
#define VERSTAG "\0$VER: stack.lib 1.191 (9.4.2005)"
|
#define VERSTAG "\0$VER: stack.lib 1.192 (12.5.2005)"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
191
|
192
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: stdio_vfprintf.c,v 1.16 2005-05-08 11:27:26 obarthel Exp $
|
* $Id: stdio_vfprintf.c,v 1.17 2005-05-12 14:42:32 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@ -69,6 +69,10 @@
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
STATIC int
|
STATIC int
|
||||||
get_num_leading_digits(__long_double_t v,int radix)
|
get_num_leading_digits(__long_double_t v,int radix)
|
||||||
{
|
{
|
||||||
@ -139,11 +143,14 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
char *output_buffer;
|
char *output_buffer;
|
||||||
int output_len;
|
int output_len;
|
||||||
char *prefix;
|
char *prefix;
|
||||||
|
char prefix_buffer[8];
|
||||||
int result = EOF;
|
int result = EOF;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#if defined(FLOATING_POINT_SUPPORT)
|
#if defined(FLOATING_POINT_SUPPORT)
|
||||||
|
char * internal_buffer = NULL;
|
||||||
|
size_t internal_buffer_size = 0;
|
||||||
char trail_string[8];
|
char trail_string[8];
|
||||||
int trail_string_len;
|
int trail_string_len;
|
||||||
int num_trailing_zeroes;
|
int num_trailing_zeroes;
|
||||||
@ -761,6 +768,8 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
{
|
{
|
||||||
BOOL strip_trailing_zeroes = FALSE;
|
BOOL strip_trailing_zeroes = FALSE;
|
||||||
__long_double_t roundoff_fudge = 0.0;
|
__long_double_t roundoff_fudge = 0.0;
|
||||||
|
int num_output_characters;
|
||||||
|
int num_leading_digits;
|
||||||
int max_digits = -1;
|
int max_digits = -1;
|
||||||
int exponent = 0;
|
int exponent = 0;
|
||||||
int digit;
|
int digit;
|
||||||
@ -881,19 +890,52 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
|
|
||||||
SHOWMSG("integral part");
|
SHOWMSG("integral part");
|
||||||
|
|
||||||
|
num_leading_digits = get_num_leading_digits(v,radix);
|
||||||
|
|
||||||
|
SHOWVALUE(num_leading_digits);
|
||||||
|
|
||||||
|
/* Figure out how much room the number will need in order
|
||||||
|
to be stored. */
|
||||||
|
num_output_characters =
|
||||||
|
1 + /* sign */
|
||||||
|
num_leading_digits + /* integral part */
|
||||||
|
1 + /* decimal point */
|
||||||
|
max(0,max(precision,max_digits)) + /* fractional part */
|
||||||
|
1 + /* 'e' or 'p' */
|
||||||
|
1 + /* sign of the exponent */
|
||||||
|
32 + /* exponent */
|
||||||
|
1; /* NUL termination */
|
||||||
|
|
||||||
|
/* Can we store that much? */
|
||||||
|
if((size_t)num_output_characters > sizeof(buffer))
|
||||||
|
{
|
||||||
|
if((size_t)num_output_characters > internal_buffer_size)
|
||||||
|
{
|
||||||
|
char * new_internal_buffer;
|
||||||
|
|
||||||
|
/* Try to (re-)allocate a larger output buffer. */
|
||||||
|
new_internal_buffer = realloc(internal_buffer,(size_t)num_output_characters);
|
||||||
|
if(new_internal_buffer == NULL)
|
||||||
|
{
|
||||||
|
__set_errno(ENOMEM);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal_buffer = new_internal_buffer;
|
||||||
|
internal_buffer_size = (size_t)num_output_characters;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer_start = internal_buffer;
|
||||||
|
buffer_stop = &internal_buffer[internal_buffer_size - 1];
|
||||||
|
}
|
||||||
|
|
||||||
if(v >= 1.0)
|
if(v >= 1.0)
|
||||||
{
|
{
|
||||||
int num_leading_digits;
|
|
||||||
|
|
||||||
/* 'Normalize' the number so that we have a zero in
|
/* 'Normalize' the number so that we have a zero in
|
||||||
front of the mantissa. We can't lose here: we
|
front of the mantissa. We can't lose here: we
|
||||||
simply scale the value without any loss of
|
simply scale the value without any loss of
|
||||||
precision (we just change the floating point
|
precision (we just change the floating point
|
||||||
exponent). */
|
exponent). */
|
||||||
num_leading_digits = get_num_leading_digits(v,radix);
|
|
||||||
|
|
||||||
SHOWVALUE(num_leading_digits);
|
|
||||||
|
|
||||||
v /= pow(radix,(double)num_leading_digits);
|
v /= pow(radix,(double)num_leading_digits);
|
||||||
|
|
||||||
for(i = 0 ; (max_digits != 0) && (i < num_leading_digits) && (output_buffer < buffer_stop) ; i++)
|
for(i = 0 ; (max_digits != 0) && (i < num_leading_digits) && (output_buffer < buffer_stop) ; i++)
|
||||||
@ -989,8 +1031,6 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
|
|
||||||
output_len = output_buffer - buffer_start;
|
output_len = output_buffer - buffer_start;
|
||||||
|
|
||||||
assert(output_len < (int)sizeof(buffer));
|
|
||||||
|
|
||||||
D(("length = %ld, output_buffer = '%s'",output_len,buffer_start));
|
D(("length = %ld, output_buffer = '%s'",output_len,buffer_start));
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
@ -1066,8 +1106,6 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
output_len = output_buffer - buffer_start;
|
output_len = output_buffer - buffer_start;
|
||||||
output_buffer = buffer_start;
|
output_buffer = buffer_start;
|
||||||
|
|
||||||
assert(output_len < (int)sizeof(buffer));
|
|
||||||
|
|
||||||
D(("length = %ld, output_buffer = '%s'",output_len,output_buffer));
|
D(("length = %ld, output_buffer = '%s'",output_len,output_buffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1466,31 +1504,22 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
|
|
||||||
/* Get ready to prefix a sign character, if required. */
|
/* Get ready to prefix a sign character, if required. */
|
||||||
if(FLAG_IS_SET(format_flags,FORMATF_IsNegative))
|
if(FLAG_IS_SET(format_flags,FORMATF_IsNegative))
|
||||||
{
|
|
||||||
prefix = "-";
|
prefix = "-";
|
||||||
}
|
|
||||||
else if (FLAG_IS_SET(format_flags,FORMATF_ProduceSign))
|
else if (FLAG_IS_SET(format_flags,FORMATF_ProduceSign))
|
||||||
{
|
|
||||||
prefix = "+";
|
prefix = "+";
|
||||||
}
|
|
||||||
else if (FLAG_IS_SET(format_flags,FORMATF_ProduceSpace))
|
else if (FLAG_IS_SET(format_flags,FORMATF_ProduceSpace))
|
||||||
{
|
|
||||||
prefix = " ";
|
prefix = " ";
|
||||||
}
|
|
||||||
else if (FLAG_IS_SET(format_flags,FORMATF_ZeroPrefix))
|
else if (FLAG_IS_SET(format_flags,FORMATF_ZeroPrefix))
|
||||||
{
|
|
||||||
prefix = "0";
|
prefix = "0";
|
||||||
}
|
|
||||||
else if (FLAG_IS_SET(format_flags,FORMATF_HexPrefix))
|
|
||||||
{
|
|
||||||
if(FLAG_IS_SET(format_flags,FORMATF_CapitalLetters))
|
|
||||||
prefix = "0X";
|
|
||||||
else
|
|
||||||
prefix = "0x";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
prefix = NULL;
|
prefix = NULL;
|
||||||
|
|
||||||
|
if(FLAG_IS_SET(format_flags,FORMATF_HexPrefix))
|
||||||
|
{
|
||||||
|
strcpy(prefix_buffer,(prefix != NULL ? prefix : ""));
|
||||||
|
strcat(prefix_buffer,FLAG_IS_SET(format_flags,FORMATF_CapitalLetters) ? "0X" : "0x");
|
||||||
|
|
||||||
|
prefix = prefix_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FLAG_IS_SET(format_flags,FORMATF_LeftJustified))
|
if(FLAG_IS_SET(format_flags,FORMATF_LeftJustified))
|
||||||
@ -1647,6 +1676,13 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
||||||
|
#if defined(FLOATING_POINT_SUPPORT)
|
||||||
|
{
|
||||||
|
if(internal_buffer != NULL && internal_buffer_size > 0)
|
||||||
|
free(internal_buffer);
|
||||||
|
}
|
||||||
|
#endif /* FLOATING_POINT_SUPPORT */
|
||||||
|
|
||||||
/* Note: if buffering is disabled for this stream, then we still
|
/* Note: if buffering is disabled for this stream, then we still
|
||||||
may have buffered data around, queued to be printed right now.
|
may have buffered data around, queued to be printed right now.
|
||||||
This is intended to improve performance as it takes more effort
|
This is intended to improve performance as it takes more effort
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 191
|
#define REVISION 192
|
||||||
#define DATE "9.4.2005"
|
#define DATE "12.5.2005"
|
||||||
#define VERS "unix.lib 1.191"
|
#define VERS "unix.lib 1.192"
|
||||||
#define VSTRING "unix.lib 1.191 (9.4.2005)\r\n"
|
#define VSTRING "unix.lib 1.192 (12.5.2005)\r\n"
|
||||||
#define VERSTAG "\0$VER: unix.lib 1.191 (9.4.2005)"
|
#define VERSTAG "\0$VER: unix.lib 1.192 (12.5.2005)"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
191
|
192
|
||||||
|
|||||||
Reference in New Issue
Block a user