2008-11-10 14:41 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
* harbour/source/common/hbstr.c
+ added hb_numToStr()
* harbour/source/vm/estack.c
* harbour/source/compiler/genc.c
* harbour/source/compiler/gencc.c
* use hb_numToStr() for integer number conversions
* harbour/source/vm/dlmalloc.c
* disable #pragma warning ... in MinGW builds. If some newer MinGW
versions support it and it's useful then it can be enabled after
checking MinGW version
This commit is contained in:
@@ -8,6 +8,21 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
|
||||
*/
|
||||
|
||||
2008-11-10 14:41 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbapi.h
|
||||
* harbour/source/common/hbstr.c
|
||||
+ added hb_numToStr()
|
||||
|
||||
* harbour/source/vm/estack.c
|
||||
* harbour/source/compiler/genc.c
|
||||
* harbour/source/compiler/gencc.c
|
||||
* use hb_numToStr() for integer number conversions
|
||||
|
||||
* harbour/source/vm/dlmalloc.c
|
||||
* disable #pragma warning ... in MinGW builds. If some newer MinGW
|
||||
versions support it and it's useful then it can be enabled after
|
||||
checking MinGW version
|
||||
|
||||
2008-11-10 09:50 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
|
||||
* include/hbmath.h
|
||||
! Fixed Pelles C 5.00 not having an 'inf' (HUGE_VAL) symbol
|
||||
|
||||
@@ -862,7 +862,7 @@ extern HB_EXPORT ULONG hb_strRTrimLen( const char * szText, ULONG ulLen, BOO
|
||||
extern HB_EXPORT double hb_strVal( const char * szText, ULONG ulLen );
|
||||
extern HB_EXPORT HB_LONG hb_strValInt( const char * szText, int * iOverflow );
|
||||
extern HB_EXPORT char * hb_strRemEscSeq( char * szText, ULONG * ulLen ); /* remove C ESC sequences and converts them to Clipper chars */
|
||||
|
||||
extern HB_EXPORT char * hb_numToStr( char * szBuf, ULONG ulSize, HB_LONG lNumber );
|
||||
extern HB_EXPORT double hb_numRound( double dResult, int iDec ); /* round a number to a specific number of digits */
|
||||
extern HB_EXPORT double hb_numInt( double dNum ); /* take the integer part of the number */
|
||||
extern HB_EXPORT double hb_numDecConv( double dNum, int iDec );
|
||||
|
||||
@@ -756,6 +756,41 @@ HB_LONG hb_strValInt( const char * szText, int * iOverflow )
|
||||
return lVal;
|
||||
}
|
||||
|
||||
char * hb_numToStr( char * szBuf, ULONG ulSize, HB_LONG lNumber )
|
||||
{
|
||||
int iPos = ( int ) ulSize;
|
||||
BOOL fNeg = FALSE;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_numToStr(%p, %lu, %" PFHL "i)", szBuf, ulSize, lNumber));
|
||||
|
||||
szBuf[ --iPos ] = '\0';
|
||||
if( lNumber < 0 )
|
||||
{
|
||||
fNeg = TRUE;
|
||||
lNumber = -lNumber;
|
||||
}
|
||||
|
||||
while( --iPos >= 0 )
|
||||
{
|
||||
szBuf[ iPos ] = '0' + ( char ) ( lNumber % 10 );
|
||||
lNumber /= 10;
|
||||
if( lNumber == 0 )
|
||||
break;
|
||||
}
|
||||
if( fNeg && --iPos >= 0 )
|
||||
szBuf[ iPos ] = '-';
|
||||
|
||||
if( iPos > 0 )
|
||||
memset( szBuf, ' ', iPos );
|
||||
else if( iPos < 0 )
|
||||
{
|
||||
memset( szBuf, '*', ulSize - 1 );
|
||||
iPos = 0;
|
||||
}
|
||||
|
||||
return &szBuf[ iPos ];
|
||||
}
|
||||
|
||||
/*
|
||||
* This function copies szText to destination buffer.
|
||||
* NOTE: Unlike the documentation for strncpy, this routine will always append
|
||||
@@ -1023,7 +1058,6 @@ char * hb_strRemEscSeq( char *str, ULONG *pLen )
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
}
|
||||
*dst++ = ch;
|
||||
}
|
||||
|
||||
@@ -1583,7 +1583,9 @@ static HB_GENC_FUNC( hb_p_pushlonglong )
|
||||
#ifdef HB_LONG_LONG_OFF
|
||||
fprintf( cargo->yyc, "\t/* %f */", HB_PCODE_MKLONGLONG( &pFunc->pCode[ lPCodePos + 1 ] ) );
|
||||
#else
|
||||
fprintf( cargo->yyc, "\t/* %" PFLL "i */", HB_PCODE_MKLONGLONG( &pFunc->pCode[ lPCodePos + 1 ] ) );
|
||||
char szBuf[ 24 ];
|
||||
fprintf( cargo->yyc, "\t/* %s */", hb_numToStr( szBuf, sizeof( szBuf ),
|
||||
HB_PCODE_MKLONGLONG( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
|
||||
#endif
|
||||
}
|
||||
fprintf( cargo->yyc, "\n" );
|
||||
|
||||
@@ -1243,8 +1243,11 @@ static HB_GENC_FUNC( hb_p_pushlonglong )
|
||||
}
|
||||
return 9 + iSkip;
|
||||
#else
|
||||
char szBuf[ 24 ];
|
||||
HB_GENC_LABEL();
|
||||
fprintf( cargo->yyc, "\thb_xvmPushLongLong( HB_LL( %" PFLL "i ) );\n", HB_PCODE_MKLONGLONG( &pFunc->pCode[ lPCodePos + 1 ] ) );
|
||||
fprintf( cargo->yyc, "\thb_xvmPushLongLong( HB_LL( %s ) );\n",
|
||||
hb_numToStr( szBuf, sizeof( szBuf ),
|
||||
HB_PCODE_MKLONGLONG( &pFunc->pCode[ lPCodePos + 1 ] ) ) );
|
||||
return 9;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1141,7 +1141,9 @@ int mspace_mallopt(int, int);
|
||||
/*------------------------------ internal #includes ---------------------- */
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef __MINGW32__
|
||||
#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
|
||||
#endif /* __MINGW32__ */
|
||||
#endif /* WIN32 */
|
||||
|
||||
#include <stdio.h> /* for printing in malloc_stats */
|
||||
|
||||
@@ -1081,8 +1081,11 @@ void hb_stackDispLocal( void )
|
||||
break;
|
||||
|
||||
case HB_IT_LONG:
|
||||
printf( HB_I_("LONG = %" PFHL "i ") , hb_itemGetNInt( *pBase ) );
|
||||
{
|
||||
char szBuf[ 24 ];
|
||||
printf( HB_I_("LONG = %s ") , hb_numToStr( szBuf, sizeof( szBuf ), hb_itemGetNInt( *pBase ) ) );
|
||||
break;
|
||||
}
|
||||
|
||||
case HB_IT_INTEGER:
|
||||
printf( HB_I_("INTEGER = %i "), hb_itemGetNI( *pBase ) );
|
||||
|
||||
Reference in New Issue
Block a user