From c1318e95cd7dc8fc54a660eb114eacc45e95f7e1 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 5 Nov 2008 02:01:15 +0000 Subject: [PATCH] 2008-11-05 03:01 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapi.h * harbour/source/vm/hashes.c * harbour/source/vm/hashfunc.c * changed hb_hSort() to execute sorting when hash is marked as needed resorting instead of marking hash for resorting * harbour/source/vm/fm.c * formatting * harbour/contrib/hbdbgfx/dbgfxc.c ! fixed casting in ASCII build + added support for UNICODE builds * harbour/contrib/gtwvg/gtwvg.c * cover LWA_ALPHA usage by #if ( _WIN32_WINNT >= 0x0500 ) to keep at least compile time compatibility with older systems --- harbour/ChangeLog | 18 ++++++++++++++++++ harbour/contrib/gtwvg/gtwvg.c | 2 ++ harbour/contrib/hbdbgfx/dbgfxc.c | 10 +++++++++- harbour/include/hbapi.h | 1 + harbour/source/vm/fm.c | 4 ++-- harbour/source/vm/hashes.c | 13 +++++++++++++ harbour/source/vm/hashfunc.c | 2 +- 7 files changed, 46 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5799cfe5be..f54fd3f0b3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,24 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-11-05 03:01 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbapi.h + * harbour/source/vm/hashes.c + * harbour/source/vm/hashfunc.c + * changed hb_hSort() to execute sorting when hash is marked as needed + resorting instead of marking hash for resorting + + * harbour/source/vm/fm.c + * formatting + + * harbour/contrib/hbdbgfx/dbgfxc.c + ! fixed casting in ASCII build + + added support for UNICODE builds + + * harbour/contrib/gtwvg/gtwvg.c + * cover LWA_ALPHA usage by #if ( _WIN32_WINNT >= 0x0500 ) + to keep at least compile time compatibility with older systems + 2008-11-04 15:54 UTC-0600 Teo Fonrouge (teo/at/windtelsoft/dot/com) * source/vm/fm.c * removed unneeded HB_FUNC( MEMORY ), now in fmhb.c diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index 717db5dcde..29cecf9487 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -3031,10 +3031,12 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) GWL_EXSTYLE, GetWindowLong( pWVT->hWnd, GWL_EXSTYLE ) | WS_EX_LAYERED ); +#if ( _WIN32_WINNT >= 0x0500 ) pWVT->pfnLayered( pWVT->hWnd, RGB( 255,255,255 ), hb_itemGetNI( pInfo->pNewVal2 ), /*LWA_COLORKEY|*/ LWA_ALPHA ); +#endif } } break; diff --git a/harbour/contrib/hbdbgfx/dbgfxc.c b/harbour/contrib/hbdbgfx/dbgfxc.c index e955b69270..d163b5b776 100644 --- a/harbour/contrib/hbdbgfx/dbgfxc.c +++ b/harbour/contrib/hbdbgfx/dbgfxc.c @@ -82,7 +82,15 @@ HB_EXPORT void hb_ToOutDebug( const char * sTraceMsg, ... ) vsnprintf( buffer, sizeof( buffer ), sTraceMsg, ap ); va_end( ap ); - OutputDebugString( ( LPCWSTR ) buffer ); +#if defined(UNICODE) + { + TCHAR buf[1024]; + HB_TCHAR_CPTO( buf, buffer, sizeof( buffer ) - 1 ); + OutputDebugString( buf ); + } +#else + OutputDebugString( ( LPCTSTR ) buffer ); +#endif #else /* TODO: Implement. */ #endif diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index f6ca7a79c7..4a903acd3e 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -757,6 +757,7 @@ extern HB_EXPORT BOOL hb_hashAdd( PHB_ITEM pHash, PHB_ITEM pKey, PHB_ITEM p extern HB_EXPORT BOOL hb_hashAddNew( PHB_ITEM pHash, PHB_ITEM pKey, PHB_ITEM pValue ); extern HB_EXPORT BOOL hb_hashRemove( PHB_ITEM pHash, PHB_ITEM pItem ); extern HB_EXPORT BOOL hb_hashAllocNewPair( PHB_ITEM pHash, PHB_ITEM * pKeyPtr, PHB_ITEM * pValPtr ); +extern HB_EXPORT void hb_hashSort( PHB_ITEM pHash ); extern HB_EXPORT PHB_ITEM hb_hashClone( PHB_ITEM pSource ); extern HB_EXPORT void hb_hashJoin( PHB_ITEM pDest, PHB_ITEM pSource, int iType ); extern HB_EXPORT BOOL hb_hashScan( PHB_ITEM pHash, PHB_ITEM pKey, ULONG * pulPos ); diff --git a/harbour/source/vm/fm.c b/harbour/source/vm/fm.c index b0b6c98f6a..105df72b0e 100644 --- a/harbour/source/vm/fm.c +++ b/harbour/source/vm/fm.c @@ -777,10 +777,10 @@ HB_EXPORT void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ { char szTime[ 9 ]; int iYear, iMonth, iDay; - + hb_dateToday( &iYear, &iMonth, &iDay ); hb_dateTimeStr( szTime ); - + fprintf( hLog, HB_I_("Application Memory Allocation Report - %s\n"), hb_cmdargARGV()[0] ); fprintf( hLog, HB_I_("Terminated at: %04d.%02d.%02d %s\n"), iYear, iMonth, iDay, szTime ); if( s_szInfo[ 0 ] ) diff --git a/harbour/source/vm/hashes.c b/harbour/source/vm/hashes.c index b7aa314ce6..5322157a07 100644 --- a/harbour/source/vm/hashes.c +++ b/harbour/source/vm/hashes.c @@ -420,6 +420,8 @@ HB_EXPORT ULONG hb_hashLen( PHB_ITEM pHash ) HB_EXPORT void hb_hashPreallocate( PHB_ITEM pHash, ULONG ulNewSize ) { + HB_TRACE(HB_TR_DEBUG, ("hb_hashPreallocate(%p,%lu)", pHash, ulNewSize)); + if( HB_IS_HASH( pHash ) ) hb_hashResize( pHash->item.asHash.value, ulNewSize ); } @@ -437,6 +439,17 @@ HB_EXPORT BOOL hb_hashAllocNewPair( PHB_ITEM pHash, PHB_ITEM * pKeyPtr, PHB_ITEM return FALSE; } +HB_EXPORT void hb_hashSort( PHB_ITEM pHash ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_hashSort(%p)", pHash)); + + if( HB_IS_HASH( pHash ) ) + { + if( pHash->item.asHash.value->iFlags & HB_HASH_RESORT ) + hb_hashResort( pHash->item.asHash.value ); + } +} + HB_EXPORT PHB_ITEM hb_hashGetItemPtr( PHB_ITEM pHash, PHB_ITEM pKey, int iFlags ) { HB_TRACE(HB_TR_DEBUG, ("hb_hashGetItemPtr(%p,%p,%d)", pHash, pKey, iFlags)); diff --git a/harbour/source/vm/hashfunc.c b/harbour/source/vm/hashfunc.c index 5d48b21b31..ef23ed043e 100644 --- a/harbour/source/vm/hashfunc.c +++ b/harbour/source/vm/hashfunc.c @@ -610,7 +610,7 @@ HB_FUNC( HB_HSORT ) if( pHash ) { - hb_hashSetFlags( pHash, HB_HASH_RESORT ); + hb_hashSort( pHash ); hb_itemReturn( pHash ); } else