From 5da96d8c2a8f94efcb180b5677d6fe6033584b98 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 10 Jul 2009 19:21:40 +0000 Subject: [PATCH] 2009-07-10 21:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * include/hbextern.ch + Added HB_SETCLSHANDLE(). * source/vm/evalhb.c * source/vm/eval.c * source/vm/dynlibhb.c ! Fixed old int <-> USHORT conversion MSVC warnings. ; TOFIX: ? There is a disagreement between different APIs and Harbour program parts on the size and type of number of parameters, it can be int, USHORT, ULONG, and in some places there is also BYTE limit. * source/common/hbver.c * Minor formatting. --- harbour/ChangeLog | 16 ++++++++++++++++ harbour/include/hbextern.ch | 1 + harbour/source/common/hbver.c | 8 ++++---- harbour/source/vm/dynlibhb.c | 12 +++++------- harbour/source/vm/eval.c | 34 +++++++++++++++++----------------- harbour/source/vm/evalhb.c | 10 +++++----- 6 files changed, 48 insertions(+), 33 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ce4f3c697c..4ffdec79a5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,22 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-10 21:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * include/hbextern.ch + + Added HB_SETCLSHANDLE(). + + * source/vm/evalhb.c + * source/vm/eval.c + * source/vm/dynlibhb.c + ! Fixed old int <-> USHORT conversion MSVC warnings. + ; TOFIX: ? There is a disagreement between different APIs + and Harbour program parts on the size and type of + number of parameters, it can be int, USHORT, ULONG, + and in some places there is also BYTE limit. + + * source/common/hbver.c + * Minor formatting. + 2009-07-10 20:31 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * source/rtl/xhelp.c ! Silenced MSVC warning. diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 43426de2bd..aa2f072df5 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -928,6 +928,7 @@ EXTERNAL HB_MACROBLOCK EXTERNAL HB_MMIDDLEDOWN EXTERNAL HB_STRFORMAT EXTERNAL HB_ALERT +EXTERNAL HB_SETCLSHANDLE EXTERNAL HB_INISETCOMMENT EXTERNAL HB_INIREAD diff --git a/harbour/source/common/hbver.c b/harbour/source/common/hbver.c index 1e37d5a3bf..95513b7b1b 100644 --- a/harbour/source/common/hbver.c +++ b/harbour/source/common/hbver.c @@ -513,7 +513,7 @@ char * hb_verCompiler( void ) #elif defined( _MSC_VER ) - #if (_MSC_VER >= 800) + #if ( _MSC_VER >= 800 ) pszName = "Microsoft Visual C"; #else pszName = "Microsoft C"; @@ -534,16 +534,16 @@ char * hb_verCompiler( void ) #elif defined( __BORLANDC__ ) - #if (__BORLANDC__ >= 1424) /* Version 5.9 */ + #if ( __BORLANDC__ >= 1424 ) /* Version 5.9 */ pszName = "CodeGear C++"; #else pszName = "Borland C++"; #endif - #if (__BORLANDC__ == 1040) /* Version 3.1 */ + #if ( __BORLANDC__ == 1040 ) /* Version 3.1 */ iVerMajor = 3; iVerMinor = 1; iVerPatch = 0; - #elif (__BORLANDC__ >= 1280) /* Version 5.x */ + #elif ( __BORLANDC__ >= 1280 ) /* Version 5.x */ iVerMajor = __BORLANDC__ >> 8; iVerMinor = ( __BORLANDC__ & 0xFF ) >> 4; iVerPatch = __BORLANDC__ & 0xF; diff --git a/harbour/source/vm/dynlibhb.c b/harbour/source/vm/dynlibhb.c index 32fd7f269c..cf34d218a3 100644 --- a/harbour/source/vm/dynlibhb.c +++ b/harbour/source/vm/dynlibhb.c @@ -174,19 +174,17 @@ HB_FUNC( HB_LIBDO ) if( pDynSym ) { - USHORT uiPCount = hb_pcount(); - USHORT uiParam; + int iPCount = hb_pcount(); + int iParam; hb_vmPushSymbol( pDynSym->pSymbol ); hb_vmPushNil(); /* same logic here as from HB_FUNC( EVAL ) */ - for( uiParam = 2; uiParam <= uiPCount; uiParam++ ) - { - hb_vmPush( hb_stackItemFromBase( uiParam ) ); - } + for( iParam = 2; iParam <= iPCount; iParam++ ) + hb_vmPush( hb_stackItemFromBase( iParam ) ); - hb_vmProc( ( USHORT ) ( uiPCount - 1 ) ); + hb_vmProc( ( USHORT ) ( iPCount - 1 ) ); } } } diff --git a/harbour/source/vm/eval.c b/harbour/source/vm/eval.c index d32a1e2cb4..3f24ae1d6c 100644 --- a/harbour/source/vm/eval.c +++ b/harbour/source/vm/eval.c @@ -295,7 +295,7 @@ PHB_ITEM hb_itemDoC( const char * szFunc, ULONG ulPCount, ... ) hb_vmPush( va_arg( va, PHB_ITEM ) ); va_end( va ); } - hb_vmProc( ( unsigned short ) ulPCount ); + hb_vmProc( ( USHORT ) ulPCount ); pResult = hb_itemNew( hb_stackReturnItem() ); hb_vmRequestRestore(); } @@ -419,14 +419,14 @@ HB_FUNC( HB_EXECFROMARRAY ) PHB_ITEM pArray = NULL; PHB_ITEM pItem; ULONG ulParamOffset = 0; - USHORT usPCount = hb_pcount(); + int iPCount = hb_pcount(); /* decode parameters */ - if( usPCount ) + if( iPCount ) { - PHB_ITEM pParam = hb_param( 1, HB_IT_ANY ); + PHB_ITEM pParam = hb_param( 1, HB_IT_ANY ); - if( usPCount == 1 ) + if( iPCount == 1 ) { if( HB_IS_ARRAY( pParam ) && !HB_IS_OBJECT( pParam ) ) { @@ -447,13 +447,13 @@ HB_FUNC( HB_EXECFROMARRAY ) else pFunc = pParam; } - else if( HB_IS_OBJECT( pParam ) && usPCount <= 3 ) + else if( HB_IS_OBJECT( pParam ) && iPCount <= 3 ) { pSelf = pParam; pFunc = hb_param( 2, HB_IT_ANY ); pArray = hb_param( 3, HB_IT_ANY ); } - else if( usPCount == 2 ) + else if( iPCount == 2 ) { pFunc = pParam; pArray = hb_param( 2, HB_IT_ANY ); @@ -475,7 +475,7 @@ HB_FUNC( HB_EXECFROMARRAY ) if( pExecSym ) { - usPCount = 0; + iPCount = 0; hb_vmPushSymbol( pExecSym ); if( pSelf ) hb_vmPush( pSelf ); @@ -485,18 +485,18 @@ HB_FUNC( HB_EXECFROMARRAY ) if( pArray ) { pItem = hb_arrayGetItemPtr( pArray, ++ulParamOffset ); - while( pItem && usPCount < 255 ) + while( pItem && iPCount < 255 ) { hb_vmPush( pItem ); - ++usPCount; + ++iPCount; pItem = hb_arrayGetItemPtr( pArray, ++ulParamOffset ); } } if( pSelf ) - hb_vmSend( usPCount ); + hb_vmSend( ( USHORT ) iPCount ); else - hb_vmProc( usPCount ); + hb_vmProc( ( USHORT ) iPCount ); } else hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); @@ -508,7 +508,7 @@ BOOL hb_execFromArray( PHB_ITEM pParam ) PHB_ITEM pArray = NULL; PHB_ITEM pSelf = NULL; ULONG ulParamOffset = 0; - USHORT usPCount = 0; + int iPCount = 0; if( pParam && HB_IS_ARRAY( pParam ) && !HB_IS_OBJECT( pParam ) ) { @@ -547,18 +547,18 @@ BOOL hb_execFromArray( PHB_ITEM pParam ) if( pArray ) { pParam = hb_arrayGetItemPtr( pArray, ++ulParamOffset ); - while( pParam && usPCount < 255 ) + while( pParam && iPCount < 255 ) { hb_vmPush( pParam ); - ++usPCount; + ++iPCount; pParam = hb_arrayGetItemPtr( pArray, ++ulParamOffset ); } } if( pSelf ) - hb_vmSend( usPCount ); + hb_vmSend( ( USHORT ) iPCount ); else - hb_vmProc( usPCount ); + hb_vmProc( ( USHORT ) iPCount ); return TRUE; } diff --git a/harbour/source/vm/evalhb.c b/harbour/source/vm/evalhb.c index 38e3359eba..37661788f1 100644 --- a/harbour/source/vm/evalhb.c +++ b/harbour/source/vm/evalhb.c @@ -63,8 +63,8 @@ HB_FUNC( EVAL ) if( pItem ) { - USHORT uiPCount = hb_pcount(); - USHORT uiParam; + int iPCount = hb_pcount(); + int iParam; hb_vmPushSymbol( &hb_symEval ); hb_vmPush( pItem ); @@ -72,10 +72,10 @@ HB_FUNC( EVAL ) * because we need to pass the references too. * hb_param() is dereferencing the passed parameters */ - for( uiParam = 2; uiParam <= uiPCount; uiParam++ ) - hb_vmPush( hb_stackItemFromBase( uiParam ) ); + for( iParam = 2; iParam <= iPCount; iParam++ ) + hb_vmPush( hb_stackItemFromBase( iParam ) ); - hb_vmSend( ( USHORT ) ( uiPCount - 1 ) ); + hb_vmSend( ( USHORT ) ( iPCount - 1 ) ); } else hb_errRT_BASE_SubstR( EG_NOMETHOD, 1004, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );