diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e2618a42bb..1b5771f668 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,48 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-01-26 21:18 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * source/common/hbprintf.c + ! Some fixes to make it compile under BCC. + Still doesn't compile however. + I'll rather disable this code for now, unless someone jumps + in an fixes these problems. + ; TOFIX: For MSVC, too: + source\common\hbprintf.c(213) : error C2061: syntax error : identifier 'intmax_t' + source\common\hbprintf.c(214) : error C2061: syntax error : identifier 'as_x_uintmax_t' + source\common\hbprintf.c(214) : error C2059: syntax error : ';' + source\common\hbprintf.c(222) : error C2059: syntax error : '}' + source\common\hbprintf.c(226) : error C2061: syntax error : identifier 'x_type' + source\common\hbprintf.c(227) : error C2059: syntax error : '}' + source\common\hbprintf.c(379) : error C2146: syntax error : missing ')' before identifier 'value' + source\common\hbprintf.c(379) : error C2081: 'uintmax_t' : name in formal parameter list illegal + source\common\hbprintf.c(379) : error C2061: syntax error : identifier 'value' + source\common\hbprintf.c(379) : error C2059: syntax error : ';' + source\common\hbprintf.c(379) : error C2059: syntax error : ',' + source\common\hbprintf.c(379) : error C2059: syntax error : ')' + source\common\hbprintf.c(434) : error C2146: syntax error : missing ')' before identifier 'value' + source\common\hbprintf.c(434) : error C2081: 'uintmax_t' : name in formal parameter list illegal + source\common\hbprintf.c(434) : error C2061: syntax error : identifier 'value' + source\common\hbprintf.c(434) : error C2059: syntax error : ';' + source\common\hbprintf.c(434) : error C2059: syntax error : ',' + source\common\hbprintf.c(435) : error C2059: syntax error : ')' + source\common\hbprintf.c(615) : error C2146: syntax error : missing ')' before identifier 'value' + source\common\hbprintf.c(615) : error C2081: 'uintmax_t' : name in formal parameter list illegal + source\common\hbprintf.c(615) : error C2061: syntax error : identifier 'value' + source\common\hbprintf.c(615) : error C2059: syntax error : ';' + source\common\hbprintf.c(615) : error C2059: syntax error : ',' + source\common\hbprintf.c(616) : error C2059: syntax error : ')' + source\common\hbprintf.c(700) : error C2059: syntax error : '{' + source\common\hbprintf.c(700) : error C2065: 'n' : undeclared identifier + source\common\hbprintf.c(700) : error C2059: syntax error : ')' + source\common\hbprintf.c(702) : error C2143: syntax error : missing '{' before '-=' + source\common\hbprintf.c(702) : error C2059: syntax error : '-=' + source\common\hbprintf.c(703) : error C2059: syntax error : 'if' + source\common\hbprintf.c(710) : error C2059: syntax error : 'while' + source\common\hbprintf.c(717) : error C2059: syntax error : 'while' + source\common\hbprintf.c(725) : error C2059: syntax error : 'return' + source\common\hbprintf.c(726) : error C2059: syntax error : '}' + 2009-01-26 20:24 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com) * harbour/ChangeLog * added missed entry I haven't uploaded and fixed my wrong phrase. diff --git a/harbour/source/common/hbprintf.c b/harbour/source/common/hbprintf.c index 9ad34a79c6..d079a7d699 100644 --- a/harbour/source/common/hbprintf.c +++ b/harbour/source/common/hbprintf.c @@ -78,7 +78,7 @@ not support it then it can be eliminated by #define __NO_LONGDOUBLE__ If positional parameters are not necessary then support for them can be -diabled by +disabled by #define __NO_ARGPOS__ In such case this code neither allocates memory nor extensively use stack as memory buffer. All conversions are done "on the fly". If memory @@ -95,11 +95,21 @@ optimized. # define _GNU_SOURCE #endif +#if defined(__DJGPP__) +# include +_LIB_VERSION_TYPE _LIB_VERSION = _XOPEN_; +#else +# include +#endif + +#include "hbmath.h" + #include +#if defined( __GNUC__ ) #include +#endif #include #include -#include #ifndef __NO_ARGPOS__ # include /* malloc()/realloc()/free() */ #endif @@ -110,9 +120,19 @@ optimized. # define _EXTERN_C extern #endif +#if defined( __GNUC__ ) _EXTERN_C int hb_snprintf_c( char *buffer, size_t bufsize, const char *format, ... ) __attribute__ (( format (printf, 3, 4))); +#else +#define strnlen( s, maxlen ) \ + ( { size_t n = maxlen, size = 0; \ + while( n < maxlen && s[ size ] ) \ + ++size; \ + size; \ + } ) + +#endif #define _F_ALTERNATE 0x01 /* only for: o xX aA eE fF gG */ #define _F_ZEROPADED 0x02 /* only for: d i o u xX aA eE fF gG */ @@ -489,7 +509,11 @@ static size_t put_dbl( char *buffer, size_t bufsize, size_t size, * platform then it can be replaced by 'value < 0' but in such case * -0.0 will be shown as 0.0 */ +#if defined( __GNUC__ ) sign = signbit( value ); +#else + sign = value < 0; +#endif if( sign ) value = - value; @@ -1057,3 +1081,4 @@ int hb_snprintf_c( char * buffer, size_t bufsize, const char * format, ... ) return ( int ) size; } +