2004-10-23 02:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/bin/postinst.sh
   * changed install command syntax for Solaris compatibility

  * harbour/include/hbdefs.h
   * minor formating

  * harbour/source/vm/fm.c
   + overwrite HB_MEMINFO_SIGNATURE with 0 in hb_xfree() for detection
     redundant hb_xfree() call with the same pointer

  * harbour/source/rtl/spfiles.c
   * set the real path in second parameter of RetPath even when
     hb_spFiles fails to avoid race condition

  * harbour/source/vm/hvm.c
   ! set proper decimal value in hb_vmDivide when the integer results
     is converted into double
   ! commented out integer division optimization at runtime for Clipper
     compatibility
This commit is contained in:
Przemyslaw Czerpak
2004-10-23 01:15:55 +00:00
parent 290953d844
commit 08f5a4b48c
6 changed files with 68 additions and 28 deletions

View File

@@ -8,6 +8,27 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2004-10-23 02:50 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/postinst.sh
* changed install command syntax for Solaris compatibility
* harbour/include/hbdefs.h
* minor formating
* harbour/source/vm/fm.c
+ overwrite HB_MEMINFO_SIGNATURE with 0 in hb_xfree() for detection
redundant hb_xfree() call with the same pointer
* harbour/source/rtl/spfiles.c
* set the real path in second parameter of RetPath even when
hb_spFiles fails to avoid race condition
* harbour/source/vm/hvm.c
! set proper decimal value in hb_vmDivide when the integer results
is converted into double
! commented out integer division optimization at runtime for Clipper
compatibility
2004-10-20 17:20 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/pp/ppcore.c
+ added predefined macro __PLATFORM__UNIX for all *nix compatible

View File

@@ -46,7 +46,9 @@ then
# We must build an archive index on Darwin
AR="ar -crs"
fi
if [ "${HB_ARCHITECTURE}" != "dos" ]; then
if [ "${HB_ARCHITECTURE}" = "sunos" ]; then
install -m 755 -f "${HB_BIN_INSTALL}" "${hb_root}/bin/hb-mkslib.sh"
elif [ "${HB_ARCHITECTURE}" != "dos" ]; then
install -m 755 "${hb_root}/bin/hb-mkslib.sh" "${HB_BIN_INSTALL}/hb-mkslib"
fi
mk_hbtools "${HB_BIN_INSTALL}" "$@"

View File

@@ -67,7 +67,7 @@
*/
#if defined( HB_OS_WIN_32 )
#if !defined( HB_WIN32_IO_OFF )
#if !defined( HB_WIN32_IO_OFF )
#define HB_WIN32_IO
#endif
#if defined( HB_WIN32_IO ) && !defined( HB_OS_WIN_32_USED )
@@ -88,15 +88,15 @@
#endif
/* Include windows.h if applicable and requested */
#if defined(HB_OS_WIN_32_USED) && defined(HB_OS_WIN_32)
#if defined( HB_OS_WIN_32_USED ) && defined( HB_OS_WIN_32 )
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#if defined(__GNUC__)
#if defined( __GNUC__ )
#define HB_DONT_DEFINE_BASIC_TYPES
#endif
#elif defined(HB_OS_OS2)
#elif defined( HB_OS_OS2 )
/* With the exception of WORD, the IBM Visual Age C++ compiler has
its own definitions of the Harbour types most of which conflict with the
@@ -123,7 +123,7 @@
#undef UINT
#define HB_DONT_DEFINE_BASIC_TYPES
#elif defined(HB_OS_DOS)
#elif defined( HB_OS_DOS )
#include <dos.h>
@@ -147,7 +147,7 @@
#endif
#if ! defined(HB_DONT_DEFINE_BASIC_TYPES)
#if ! defined( HB_DONT_DEFINE_BASIC_TYPES )
#undef BOOL /* boolean */
typedef int BOOL;
@@ -525,6 +525,7 @@ typedef long HB_PTRDIFF;
# define PFHL PFLL
#endif
#define HB_SWAP_UINT64( w ) ( ( UINT64 ) ( ( ( ( UINT64 ) ( w ) & HB_LL( 0x00000000000000FF ) ) << 56 ) | \
( ( ( UINT64 ) ( w ) & HB_LL( 0x000000000000FF00 ) ) << 40 ) | \
( ( ( UINT64 ) ( w ) & HB_LL( 0x0000000000FF0000 ) ) >> 24 ) | \
@@ -891,7 +892,7 @@ typedef long HB_PTRDIFF;
* when INT64 is not supported - they are necessary for PCODE and
* database access
*/
#if defined( HB_LONG_LONG_OFF ) && !defined( UINT64_MAX )
#if defined( HB_LONG_LONG_OFF ) && !defined( HB_ARCH_64BIT )
#undef HB_GET_LE_INT64
#undef HB_GET_LE_UINT64
#undef HB_PUT_LE_UINT64
@@ -965,12 +966,12 @@ typedef PHB_FUNC HB_FUNC_PTR;
#elif defined( __WATCOMC__ )
#define HB_EXPORT __declspec( dllexport )
#elif defined( WIN32 ) && !defined( ASANT )
#define HB_EXPORT _declspec( dllexport )
#elif defined( ASANLM ) || defined( ASANT )
#define HB_EXPORT
#elif defined( WIN32 )
#define HB_EXPORT _declspec( dllexport )
#else
#define HB_EXPORT

View File

@@ -53,21 +53,21 @@
#include "hbapifs.h"
#include "hbset.h"
BOOL hb_spFile( BYTE * pFilename, BYTE RetPath[ _POSIX_PATH_MAX + 3 + 10 ] )
BOOL hb_spFile( BYTE * pFilename, BYTE * pRetPath )
{
BYTE *Path;
BOOL bIsFile = FALSE;
PHB_FNAME pFilepath;
HB_TRACE(HB_TR_DEBUG, ("hb_spFile(%s, %p)", (char*) pFilename, RetPath));
HB_TRACE(HB_TR_DEBUG, ("hb_spFile(%s, %p)", (char*) pFilename, pRetPath));
if( RetPath )
if( pRetPath )
{
Path = RetPath;
Path = pRetPath;
}
else
{
Path = (BYTE *) hb_xgrab( _POSIX_PATH_MAX + 3 + 10 );
Path = (BYTE *) hb_xgrab( _POSIX_PATH_MAX + 1 );
}
pFilepath = hb_fsFNameSplit( (char*) pFilename );
@@ -98,16 +98,23 @@ BOOL hb_spFile( BYTE * pFilename, BYTE RetPath[ _POSIX_PATH_MAX + 3 + 10 ] )
NextPath = NextPath->pNext;
}
}
/*
* This code is intentional. To eliminate race condition,
* in pending hb_spCreate()/hb_spOpen() call when we have to know
* real path and file name we have to set its deterministic value
* here. If it's not necessary the caller may drop this value.
*/
if( ! bIsFile )
{
pFilepath->szPath = hb_set.HB_SET_DEFAULT ? hb_set.HB_SET_DEFAULT : ".";
hb_fsFNameMerge( (char*) Path, pFilepath );
}
}
hb_xfree( pFilepath );
if( bIsFile == FALSE )
{
Path[0] = '\0';
}
if( RetPath == NULL )
if( pRetPath == NULL )
{
hb_xfree( Path );
}
@@ -117,7 +124,7 @@ BOOL hb_spFile( BYTE * pFilename, BYTE RetPath[ _POSIX_PATH_MAX + 3 + 10 ] )
FHANDLE hb_spOpen( BYTE * pFilename, USHORT uiFlags )
{
BYTE path[ _POSIX_PATH_MAX + 3 + 10 ];
BYTE path[ _POSIX_PATH_MAX + 1 ];
HB_TRACE(HB_TR_DEBUG, ("hb_spOpen(%p, %hu)", pFilename, uiFlags));

View File

@@ -143,8 +143,8 @@ void HB_EXPORT * hb_xalloc( ULONG ulSize ) /* allocates fixed memory, re
s_pLastBlock->pNextBlock = ( PHB_MEMINFO ) pMem;
}
s_pLastBlock = ( PHB_MEMINFO ) pMem;
( ( PHB_MEMINFO ) pMem )->pNextBlock = NULL;
( ( PHB_MEMINFO ) pMem )->pNextBlock = NULL;
( ( PHB_MEMINFO ) pMem )->ulSignature = HB_MEMINFO_SIGNATURE;
HB_PUT_LONG( ( ( BYTE * ) pMem ) + ulSize + sizeof(HB_MEMINFO), HB_MEMINFO_SIGNATURE );
( ( PHB_MEMINFO ) pMem )->ulSize = ulSize; /* size of the memory block */
@@ -225,8 +225,8 @@ void HB_EXPORT * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exi
s_pLastBlock->pNextBlock = ( PHB_MEMINFO ) pMem;
}
s_pLastBlock = ( PHB_MEMINFO ) pMem;
( ( PHB_MEMINFO ) pMem )->pNextBlock = NULL;
( ( PHB_MEMINFO ) pMem )->pNextBlock = NULL;
( ( PHB_MEMINFO ) pMem )->ulSignature = HB_MEMINFO_SIGNATURE;
HB_PUT_LONG( ( ( BYTE * ) pMem ) + ulSize + sizeof(HB_MEMINFO), HB_MEMINFO_SIGNATURE );
( ( PHB_MEMINFO ) pMem )->ulSize = ulSize; /* size of the memory block */
@@ -302,6 +302,8 @@ void HB_EXPORT * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates m
if ( HB_GET_LONG( ( ( BYTE * ) pMem ) + ulMemSize ) != HB_MEMINFO_SIGNATURE )
hb_errInternal( HB_EI_XMEMOVERFLOW, NULL, NULL, NULL );
HB_PUT_LONG( ( ( BYTE * ) pMem ) + ulMemSize, 0 );
pMem = realloc( pMemBlock, ulSize + sizeof( HB_MEMINFO ) + sizeof( ULONG ) );
s_lMemoryConsumed += ( ulSize - ulMemSize );
@@ -374,6 +376,9 @@ void HB_EXPORT hb_xfree( void * pMem ) /* frees fixed memory */
else
s_pLastBlock = pMemBlock->pPrevBlock;
pMemBlock->ulSignature = 0;
HB_PUT_LONG( ( ( BYTE * ) pMem ) + pMemBlock->ulSize, 0 );
free( ( void * ) pMemBlock );
}
else

View File

@@ -2039,7 +2039,11 @@ static void hb_vmDivide( void )
pItem1 = hb_stackItemFromTop( -2 );
pItem2 = hb_stackItemFromTop( -1 );
if( HB_IS_NUMINT( pItem1 ) && HB_IS_NUMINT( pItem2 ) )
/*
* This code is commented out for Clipper compatibility.
* See David's note below, Druzus.
*/
/* if( HB_IS_NUMINT( pItem1 ) && HB_IS_NUMINT( pItem2 ) )
{
HB_LONG lNumber2 = hb_vmPopHBLong();
HB_LONG lNumber1 = hb_vmPopHBLong();
@@ -2057,9 +2061,9 @@ static void hb_vmDivide( void )
else if ( lNumber1 % lNumber2 == 0 )
hb_vmPushNumInt( lNumber1 / lNumber2 );
else
hb_vmPushDouble( ( double ) lNumber1 / ( double ) lNumber2, 0 );
hb_vmPushDouble( ( ( double ) lNumber1 ) / ( double ) lNumber2, hb_set.HB_SET_DECIMALS );
}
else if( HB_IS_NUMERIC( pItem1 ) && HB_IS_NUMERIC( pItem2 ) )
else */ if( HB_IS_NUMERIC( pItem1 ) && HB_IS_NUMERIC( pItem2 ) )
{
double d2 = hb_vmPopNumber();
double d1 = hb_vmPopNumber();