diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d9d3bf5fb1..6cc0bcdb89 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,40 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-04-10 22:54 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/hbqt/Makefile + * added /usr/include to list of directories scanned for QT header files + + * harbour/contrib/hbole/olecore.c + ! added missing return + * formatting and minor cleanup + + * harbour/source/vm/arrays.c + * formatting + + * harbour/source/vm/asort.c + ! minor CA-Cl*pper compatibility fix - if sort codeblock returns + numeric value then it should be used as logical one (0 means FALSE) + + * harbour/include/hbstack.h + * harbour/source/vm/estack.c + + added macro to force static hb_stack declaration even if + HB_STACK_MACROS is internally used + + * harbour/source/vm/initsymb.c + * harbour/source/vm/hashfunc.c + * harbour/source/vm/evalhb.c + * harbour/source/vm/pcount.c + * harbour/source/vm/runner.c + * harbour/source/vm/debug.c + * harbour/source/vm/pvalue.c + * harbour/source/vm/cmdarg.c + * harbour/source/vm/proc.c + * harbour/source/vm/eval.c + * harbour/source/vm/dynlibhb.c + * do not use hbvmopt.h if it's not necessary or use hbvmint.h instead + to clean all direct references to hb_stack variable + 2009-04-10 08:00 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbqt/generator/hbqtgen.prg - Removed WIN specific castings. diff --git a/harbour/contrib/hbole/olecore.c b/harbour/contrib/hbole/olecore.c index 32dad4606e..e06d77b257 100644 --- a/harbour/contrib/hbole/olecore.c +++ b/harbour/contrib/hbole/olecore.c @@ -53,6 +53,9 @@ #include "hbwinole.h" +/* base date value in OLE (1899-12-30) as julian day */ +#define HB_OLE_DATE_BASE 0x0024D9AB + static PHB_DYNS s_pDyns_hb_oleauto; static PHB_DYNS s_pDyns_hObjAccess; static PHB_DYNS s_pDyns_hObjAssign; @@ -185,12 +188,12 @@ static void hb_oleItemToVariant( VARIANT* pVariant, PHB_ITEM pItem ) case HB_IT_DATE: pVariant->n1.n2.vt = VT_DATE; - pVariant->n1.n2.n3.dblVal = ( double ) ( hb_itemGetDL( pItem ) - 0x0024D9AB ); + pVariant->n1.n2.n3.dblVal = ( double ) ( hb_itemGetDL( pItem ) - HB_OLE_DATE_BASE ); break; case HB_IT_TIMESTAMP: pVariant->n1.n2.vt = VT_DATE; - pVariant->n1.n2.n3.dblVal = hb_itemGetTD( pItem ) - 0x0024D9AB; + pVariant->n1.n2.n3.dblVal = hb_itemGetTD( pItem ) - HB_OLE_DATE_BASE; break; case HB_IT_OBJECT: @@ -318,7 +321,7 @@ void hb_oleVariantToItem( PHB_ITEM pItem, VARIANT* pVariant ) { long lJulian, lMilliSec; - hb_timeStampUnpackDT( pVariant->n1.n2.n3.dblVal + 0x0024D9AB, &lJulian, &lMilliSec ); + hb_timeStampUnpackDT( pVariant->n1.n2.n3.dblVal + HB_OLE_DATE_BASE, &lJulian, &lMilliSec ); if( lMilliSec ) hb_itemPutTDT( pItem, lJulian, lMilliSec ); else @@ -412,13 +415,12 @@ HB_FUNC( OLECREATEOBJECT ) /* ( cOleName | cCLSID [, cIID ] ) */ } if( lOleError == S_OK ) - lOleError = CoCreateInstance( HB_ID_REF( ClassID ), NULL, CLSCTX_SERVER, fIID ? HB_ID_REF( iid ) : HB_ID_REF( IID_IDispatch ), ( void** ) &pDisp ); + lOleError = CoCreateInstance( HB_ID_REF( ClassID ), NULL, CLSCTX_SERVER, fIID ? HB_ID_REF( iid ) : HB_ID_REF( IID_IDispatch ), ( void** ) ( void * ) &pDisp ); } else lOleError = CO_E_CLASSSTRING; hb_setOleError( lOleError ); - ppDisp = ( IDispatch** ) hb_gcAlloc( sizeof( IDispatch* ), hb_ole_destructor ); *ppDisp = pDisp; hb_retptrGC( ppDisp ); @@ -468,7 +470,7 @@ HB_FUNC( OLEGETACTIVEOBJECT ) /* ( cOleName | cCLSID [, cIID ] ) */ if ( lOleError == S_OK ) #if HB_OLE_C_API - lOleError = pUnk->lpVtbl->QueryInterface( pUnk, fIID ? &iid : &IID_IDispatch, ( void** ) &pDisp ); + lOleError = pUnk->lpVtbl->QueryInterface( pUnk, fIID ? &iid : &IID_IDispatch, ( void** ) ( void * ) &pDisp ); #else lOleError = pUnk->QueryInterface( fIID ? iid : IID_IDispatch, ( void** ) &pDisp ); #endif @@ -502,11 +504,11 @@ HB_FUNC( OLERELEASE ) *ppDisp = NULL; hb_retl( TRUE ); } + else + hb_retl( FALSE ); } else hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); - - hb_retl( FALSE ); } @@ -564,6 +566,8 @@ HB_FUNC( HB_OLEAUTO___ONERROR ) hb_vmSend( 0 ); pDisp = hb_oleParam( -1 ); + if( !pDisp ) + return; szMethod = hb_itemGetSymbol( hb_stackBaseItem() )->szName; szMethodWide = AnsiToWide( szMethod ); diff --git a/harbour/contrib/hbqt/Makefile b/harbour/contrib/hbqt/Makefile index 3f453011e2..c467d9ea7e 100644 --- a/harbour/contrib/hbqt/Makefile +++ b/harbour/contrib/hbqt/Makefile @@ -38,7 +38,7 @@ ifeq ($(HB_WITH_QT),yes) ifeq ($(HB_INC_QT),) ifeq ($(HB_XBUILD),) -HB_INC_QT = /usr/include/qt4 /Developer/qt/include +HB_INC_QT = /usr/include/qt4 /usr/include /Developer/qt/include endif endif diff --git a/harbour/include/hbstack.h b/harbour/include/hbstack.h index 3e79cc8f9a..e8842b4032 100644 --- a/harbour/include/hbstack.h +++ b/harbour/include/hbstack.h @@ -246,7 +246,11 @@ typedef struct # define hb_stack_ref() ( hb_stack_ptr ) # endif # else - extern HB_STACK hb_stack; +# if defined( HB_STACK_LOCAL_MACROS ) + static HB_STACK hb_stack; +# else + extern HB_STACK hb_stack; +# endif # define hb_stack_ref() ( &hb_stack ) # endif #endif diff --git a/harbour/source/vm/arrays.c b/harbour/source/vm/arrays.c index 41df540ad0..dc0b8c1a95 100644 --- a/harbour/source/vm/arrays.c +++ b/harbour/source/vm/arrays.c @@ -214,7 +214,6 @@ BOOL hb_arraySize( PHB_ITEM pArray, ULONG ulLen ) { if( pBaseArray->ulLen < ulLen ) { - if( pBaseArray->ulAllocated < ulLen ) { /* @@ -252,8 +251,8 @@ BOOL hb_arraySize( PHB_ITEM pArray, ULONG ulLen ) } else if( ulLen < ( pBaseArray->ulAllocated >> 1 ) ) { - pBaseArray->ulAllocated = ulLen; pBaseArray->pItems = ( PHB_ITEM ) hb_xrealloc( pBaseArray->pItems, sizeof( HB_ITEM ) * ulLen ); + pBaseArray->ulAllocated = ulLen; } } } diff --git a/harbour/source/vm/asort.c b/harbour/source/vm/asort.c index 970bdee31e..964965f30e 100644 --- a/harbour/source/vm/asort.c +++ b/harbour/source/vm/asort.c @@ -58,7 +58,7 @@ SORTING AND SEARCHING ALGORITHMS: A COOKBOOK, BY THOMAS NIEMANN http://members.xoom.com/_XMCM/thomasn/s_man.htm */ -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapiitm.h" #include "hbvm.h" #include "hbstack.h" @@ -75,8 +75,11 @@ static BOOL hb_itemIsLess( PHB_ITEM pItem1, PHB_ITEM pItem2, PHB_ITEM pBlock, PH if( pBaseArray->ulLen <= ulLast ) return FALSE; - else if( HB_IS_LOGICAL( hb_stackReturnItem() ) ) - return hb_itemGetL( hb_stackReturnItem() ); + else + /* CA-Cl*pper always takes return value as logical item + * accepting 0, 1 as numeric representation of FALSE/TRUE + */ + return hb_parl( -1 ); } /* Do native compare when no codeblock is supplied */ diff --git a/harbour/source/vm/cmdarg.c b/harbour/source/vm/cmdarg.c index c2f88c0591..28c2be5d23 100644 --- a/harbour/source/vm/cmdarg.c +++ b/harbour/source/vm/cmdarg.c @@ -52,7 +52,6 @@ #define HB_OS_WIN_USED -#include "hbvmopt.h" #include "hbapi.h" #include "hbapiitm.h" #include "hbapifs.h" diff --git a/harbour/source/vm/debug.c b/harbour/source/vm/debug.c index 3c55a876a8..6020fea330 100644 --- a/harbour/source/vm/debug.c +++ b/harbour/source/vm/debug.c @@ -50,7 +50,7 @@ * */ -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapi.h" #include "hbapidbg.h" #include "hbapiitm.h" diff --git a/harbour/source/vm/dynlibhb.c b/harbour/source/vm/dynlibhb.c index 216f371ad0..c61d96ee10 100644 --- a/harbour/source/vm/dynlibhb.c +++ b/harbour/source/vm/dynlibhb.c @@ -58,7 +58,7 @@ #define HB_OS_WIN_USED #define INCL_DOSMODULEMGR -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapi.h" #include "hbapiitm.h" #include "hbstack.h" diff --git a/harbour/source/vm/estack.c b/harbour/source/vm/estack.c index 4d2f446836..0d642e394c 100644 --- a/harbour/source/vm/estack.c +++ b/harbour/source/vm/estack.c @@ -133,9 +133,9 @@ #else /* no MT mode */ -# if defined( HB_STACK_MACROS ) +# if defined( HB_STACK_MACROS ) && !defined( HB_STACK_LOCAL_MACROS ) HB_STACK hb_stack; -# else +# elif !defined( __cplusplus ) static HB_STACK hb_stack; # endif diff --git a/harbour/source/vm/eval.c b/harbour/source/vm/eval.c index 4bccc95ad2..47ab459d84 100644 --- a/harbour/source/vm/eval.c +++ b/harbour/source/vm/eval.c @@ -62,7 +62,7 @@ * */ -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapi.h" #include "hbstack.h" #include "hbapiitm.h" diff --git a/harbour/source/vm/evalhb.c b/harbour/source/vm/evalhb.c index 137604887c..7eaa01e112 100644 --- a/harbour/source/vm/evalhb.c +++ b/harbour/source/vm/evalhb.c @@ -50,7 +50,7 @@ * */ -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" diff --git a/harbour/source/vm/hashfunc.c b/harbour/source/vm/hashfunc.c index c629542c27..176f5447bd 100644 --- a/harbour/source/vm/hashfunc.c +++ b/harbour/source/vm/hashfunc.c @@ -50,7 +50,7 @@ * */ -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" @@ -351,9 +351,11 @@ HB_FUNC( HB_HMERGE ) hb_vmPush( pValue ); hb_vmPushLong( ulPos ); hb_vmSend( 3 ); - if( HB_IS_LOGICAL( hb_stackReturnItem() ) && - hb_itemGetL( hb_stackReturnItem() ) ) - hb_hashAdd( pDest, pKey, pValue ); + { + PHB_ITEM pReturn = hb_stackReturnItem(); + if( HB_IS_LOGICAL( pReturn ) && hb_itemGetL( pReturn ) ) + hb_hashAdd( pDest, pKey, pValue ); + } } else break; @@ -435,11 +437,13 @@ HB_FUNC( HB_HSCAN ) hb_vmPush( pVal ); hb_vmPushLong( ulStart ); hb_vmSend( 3 ); - if( HB_IS_LOGICAL( hb_stackReturnItem() ) && - hb_itemGetL( hb_stackReturnItem() ) ) { - fFound = TRUE; - break; + PHB_ITEM pReturn = hb_stackReturnItem(); + if( HB_IS_LOGICAL( pReturn ) && hb_itemGetL( pReturn ) ) + { + fFound = TRUE; + break; + } } } else diff --git a/harbour/source/vm/initsymb.c b/harbour/source/vm/initsymb.c index 29d6c1ad40..cc9bfcef27 100644 --- a/harbour/source/vm/initsymb.c +++ b/harbour/source/vm/initsymb.c @@ -50,7 +50,6 @@ * */ -#include "hbvmopt.h" #include "hbapi.h" #include "hbvm.h" @@ -193,4 +192,3 @@ void hb_vmSymbolInit_RT( void ) hb_vmProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); } - diff --git a/harbour/source/vm/pcount.c b/harbour/source/vm/pcount.c index b1fbc25d8e..69323fef4d 100644 --- a/harbour/source/vm/pcount.c +++ b/harbour/source/vm/pcount.c @@ -50,7 +50,7 @@ * */ -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapi.h" #include "hbapiitm.h" #include "hbstack.h" diff --git a/harbour/source/vm/proc.c b/harbour/source/vm/proc.c index f67e93fe38..086ec708c8 100644 --- a/harbour/source/vm/proc.c +++ b/harbour/source/vm/proc.c @@ -66,7 +66,7 @@ * */ -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapi.h" #include "hbapicls.h" #include "hbapiitm.h" diff --git a/harbour/source/vm/pvalue.c b/harbour/source/vm/pvalue.c index 29352c42d7..7bfeecfe8f 100644 --- a/harbour/source/vm/pvalue.c +++ b/harbour/source/vm/pvalue.c @@ -50,7 +50,7 @@ * */ -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapi.h" #include "hbapiitm.h" #include "hbstack.h" diff --git a/harbour/source/vm/runner.c b/harbour/source/vm/runner.c index f5b7cfd3e7..5c6329bf9e 100644 --- a/harbour/source/vm/runner.c +++ b/harbour/source/vm/runner.c @@ -59,7 +59,7 @@ * HB_HRBGETFUNSYM() */ -#include "hbvmopt.h" +#include "hbvmint.h" #include "hbapi.h" #include "hbstack.h" #include "hbapiitm.h"