diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e870b5c4c9..41bf6aae00 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,48 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-23 00:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * src/vm/arrays.c + * src/debug/dbgentry.c + * contrib/xhb/xhbarr.c + * contrib/xhb/xhberrc.c + * contrib/xhb/cstructc.c + * Changed to use native Harbour API function names instead of + xhb compatibility ones: + hb_itemForwardValue() -> hb_itemMove() + hb_itemPutCStatic() -> hb_itemPutCConst() + + * contrib/hbbmcdx/bmdbfcdx.c + * contrib/rddsql/sqlbase.c + * contrib/rddads/adsfunc.c + * contrib/hbwin/wce_simc.c + * contrib/hbwin/win_prn1.c + * contrib/hbwin/win_prn2.c + % hb_itemNew() + hb_arrayNew() combination replaced + with single hb_itemArrayNew() call. + + * include/hbapi.h + * include/hbapiitm.h + * Marked some legacy/compatibility functions with HB_LEGACY_LEVEL2. + This means they will be deleted in next major release version: + LEGACY/DEPRECATED RECOMMENDED EQUIVALENT + ---------------------- ----------------------- + hb_retcAdopt() hb_retc_buffer() + hb_retclenAdopt() hb_retclen_buffer() + hb_retcStatic() hb_retc_const() + hb_storclenAdopt() hb_storclen_buffer() + hb_itemPutCRawStatic() hb_itemPutCLConst() + hb_itemForwardValue() hb_itemMove() + hb_itemPutCStatic() hb_itemPutCConst() + hb_arraySetCPtr() hb_arraySetCLPtr() + + * contrib/hbwin/win_tprn.prg + * Minor formatting. + + * contrib/hbwin/win_osc.c + * Using HB_BOOL. + * Varible type notation fixed. + 2009-11-23 00:43 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/config/global.mk + added yet another path for cross-mingw compiler detection diff --git a/harbour/contrib/hbbmcdx/bmdbfcdx.c b/harbour/contrib/hbbmcdx/bmdbfcdx.c index b64ca488c9..411805ed42 100644 --- a/harbour/contrib/hbbmcdx/bmdbfcdx.c +++ b/harbour/contrib/hbbmcdx/bmdbfcdx.c @@ -7025,9 +7025,7 @@ HB_FUNC( BM_DBSEEKWILD ) bAll = HB_ISLOG( 5 ) ? hb_parl( 5 ) : FALSE; if( bAll) { - PHB_ITEM pList; - pList = hb_itemNew( NULL ); - hb_arrayNew( pList, 0 ); + PHB_ITEM pList = hb_itemArrayNew( 0 ); SELF_GOTOP( ( AREAP ) pArea ); if( hb_cdxSeekWild( (CDXAREAP) pArea, bSoftSeek, pKey, bFindLast, FALSE, bAll ) == HB_SUCCESS && pArea->fEof == FALSE && @@ -7041,8 +7039,7 @@ HB_FUNC( BM_DBSEEKWILD ) hb_arrayAdd( pList, hb_itemPutNL( NULL, ((CDXAREAP) pArea)->dbfarea.ulRecNo ) ); } } - hb_itemReturn( pList ); - hb_itemRelease( pList ); + hb_itemReturnRelease( pList ); return; } else diff --git a/harbour/contrib/hbwin/wce_simc.c b/harbour/contrib/hbwin/wce_simc.c index 63e3cabcda..ec69a75005 100644 --- a/harbour/contrib/hbwin/wce_simc.c +++ b/harbour/contrib/hbwin/wce_simc.c @@ -89,7 +89,7 @@ HB_FUNC( SIMREADPHONEBOOKENTRY ) /* hSim, nLocation, nPos, @aEntry */ HSIM hSim = ( HSIM ) hb_parptr( 1 ); DWORD dwIndex = ( DWORD ) hb_parnl( 3 ); SIMPHONEBOOKENTRY PhoneEntry; - PHB_ITEM pArray = hb_itemNew( NULL ); + PHB_ITEM pArray; char * szAddress; char * szText; @@ -99,7 +99,7 @@ HB_FUNC( SIMREADPHONEBOOKENTRY ) /* hSim, nLocation, nPos, @aEntry */ szAddress = HB_TCHAR_CONVFROM( PhoneEntry.lpszAddress ); szText = HB_TCHAR_CONVFROM( PhoneEntry.lpszText ); - hb_arrayNew( pArray, 5 ); + pArray = hb_itemArrayNew( 5 ); hb_arraySetC( pArray, 1, szAddress ); hb_arraySetC( pArray, 2, szText ); diff --git a/harbour/contrib/hbwin/win_osc.c b/harbour/contrib/hbwin/win_osc.c index 94f90ceea4..34c67cfd07 100644 --- a/harbour/contrib/hbwin/win_osc.c +++ b/harbour/contrib/hbwin/win_osc.c @@ -170,7 +170,7 @@ HB_FUNC( OS_ISWINME ) HB_FUNC( OS_ISWTSCLIENT ) { - BOOL iResult = FALSE; + HB_BOOL bResult = FALSE; OSVERSIONINFO osvi; getwinver( &osvi ); if( osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 4 ) @@ -179,9 +179,9 @@ HB_FUNC( OS_ISWTSCLIENT ) #ifndef SM_REMOTESESSION #define SM_REMOTESESSION 0x1000 #endif - iResult = GetSystemMetrics( SM_REMOTESESSION ) != 0; + bResult = GetSystemMetrics( SM_REMOTESESSION ) != 0; } - hb_retl( iResult ); + hb_retl( bResult ); } HB_FUNC( OS_VERSIONINFO ) diff --git a/harbour/contrib/hbwin/win_prn1.c b/harbour/contrib/hbwin/win_prn1.c index eeed358a31..0dbac2f3b9 100644 --- a/harbour/contrib/hbwin/win_prn1.c +++ b/harbour/contrib/hbwin/win_prn1.c @@ -611,16 +611,16 @@ HB_FUNC( WIN_DRAWBITMAP ) static int CALLBACK FontEnumCallBack( LOGFONT * lplf, TEXTMETRIC * lpntm, DWORD FontType, LPVOID pArray ) { - PHB_ITEM SubItems = hb_itemNew( NULL ); char * pszFaceName = HB_TCHAR_CONVFROM( lplf->lfFaceName ); + PHB_ITEM pSubItems = hb_itemArrayNew( 4 ); - hb_arrayNew( SubItems, 4 ); - hb_arraySetC( SubItems, 1, pszFaceName ); - hb_arraySetL( SubItems, 2, lplf->lfPitchAndFamily & FIXED_PITCH ); - hb_arraySetL( SubItems, 3, FontType & TRUETYPE_FONTTYPE ); - hb_arraySetNL( SubItems, 4, lpntm->tmCharSet ); - hb_arrayAddForward( ( PHB_ITEM ) pArray, SubItems ); - hb_itemRelease( SubItems ); + hb_arraySetC( pSubItems, 1, pszFaceName ); + hb_arraySetL( pSubItems, 2, lplf->lfPitchAndFamily & FIXED_PITCH ); + hb_arraySetL( pSubItems, 3, FontType & TRUETYPE_FONTTYPE ); + hb_arraySetNL( pSubItems, 4, lpntm->tmCharSet ); + hb_arrayAddForward( ( PHB_ITEM ) pArray, pSubItems ); + + hb_itemRelease( pSubItems ); HB_TCHAR_FREE( pszFaceName ); return TRUE; @@ -632,9 +632,7 @@ HB_FUNC( WIN_ENUMFONTS ) if( hDC ) { - PHB_ITEM pArray = hb_itemNew( NULL ); - - hb_arrayNew( pArray, 0 ); + PHB_ITEM pArray = hb_itemArrayNew( 0 ); EnumFonts( hDC, ( LPCTSTR ) NULL, ( FONTENUMPROC ) FontEnumCallBack, ( LPARAM ) pArray ); diff --git a/harbour/contrib/hbwin/win_prn2.c b/harbour/contrib/hbwin/win_prn2.c index f91fa8e10a..7ad7fb1f42 100644 --- a/harbour/contrib/hbwin/win_prn2.c +++ b/harbour/contrib/hbwin/win_prn2.c @@ -464,9 +464,7 @@ HB_FUNC( GETPRINTERS ) HB_BOOL bLocalPrintersOnly = hb_parl( 2 ); DWORD dwNeeded = 0, dwReturned = 0, i; PHB_ITEM pTempItem = hb_itemNew( NULL ); - PHB_ITEM pPrinterArray = hb_itemNew( NULL ); - - hb_arrayNew( pPrinterArray, 0 ); + PHB_ITEM pPrinterArray = hb_itemArrayNew( 0 ); EnumPrinters( _ENUMPRN_FLAGS_, NULL, 5, ( LPBYTE ) NULL, 0, &dwNeeded, &dwReturned ); diff --git a/harbour/contrib/hbwin/win_tprn.prg b/harbour/contrib/hbwin/win_tprn.prg index 24da47bcbb..c8503656f5 100644 --- a/harbour/contrib/hbwin/win_tprn.prg +++ b/harbour/contrib/hbwin/win_tprn.prg @@ -387,7 +387,7 @@ METHOD SetFont( cFontName, nPointSize, nWidth, nBold, lUnderline, lItalic, nChar ENDIF IF ( ::SetFontOk := ! Empty( ::hFont := win_CreateFont( ::hPrinterDC, ::FontName, ::FontPointSize, ::FontWidth[ 1 ], ::FontWidth[ 2 ], ::fBold, ::fUnderLine, ::fItalic, ::fCharSet ) ) ) ::fCharWidth := ::GetCharWidth() - ::CharWidth := ABS( ::fCharWidth ) + ::CharWidth := Abs( ::fCharWidth ) ::CharHeight := ::GetCharHeight() ENDIF ::FontName := win_GetPrinterFontName( ::hPrinterDC ) // Get the font name that Windows actually used @@ -488,7 +488,7 @@ METHOD TextOut( cString, lNewLine, lUpdatePosX, nAlign ) CLASS WIN_PRN DEFAULT lUpdatePosX TO .T. DEFAULT nAlign TO 0 - nPosX := win_TextOut( ::hPrinterDC, ::PosX, ::PosY, cString, LEN( cString ), ::fCharWidth, nAlign ) + nPosX := win_TextOut( ::hPrinterDC, ::PosX, ::PosY, cString, Len( cString ), ::fCharWidth, nAlign ) ::HavePrinted := .T. @@ -543,14 +543,14 @@ METHOD GetCharHeight() CLASS WIN_PRN METHOD GetTextWidth( cString ) CLASS WIN_PRN LOCAL nWidth IF ::FontWidth[ 2 ] < 0 .AND. ! Empty( ::FontWidth[ 1 ] ) - nWidth := LEN( cString ) * ::CharWidth + nWidth := Len( cString ) * ::CharWidth ELSE - nWidth := win_GetTextSize( ::hPrinterDC, cString, LEN( cString ) ) // Return Width in device units + nWidth := win_GetTextSize( ::hPrinterDC, cString, Len( cString ) ) // Return Width in device units ENDIF RETURN nWidth METHOD GetTextHeight( cString ) CLASS WIN_PRN - RETURN win_GetTextSize( ::hPrinterDC, cString, LEN( cString ), .F. ) // Return Height in device units + RETURN win_GetTextSize( ::hPrinterDC, cString, Len( cString ), .F. ) // Return Height in device units METHOD DrawBitMap( oBmp ) CLASS WIN_PRN LOCAL lResult := .F. diff --git a/harbour/contrib/rddads/adsfunc.c b/harbour/contrib/rddads/adsfunc.c index d323787ae9..6b00107287 100644 --- a/harbour/contrib/rddads/adsfunc.c +++ b/harbour/contrib/rddads/adsfunc.c @@ -2064,8 +2064,7 @@ HB_FUNC( ADSDIRECTORY ) PHB_ITEM pitmDir; ADSHANDLE hConnect = HB_ADS_PARCONNECTION( 2 ); - pitmDir = hb_itemNew( NULL ); - hb_arrayNew( pitmDir, 0 ); + pitmDir = hb_itemArrayNew( 0 ); ulRetVal = AdsFindFirstTable( hConnect, ( UNSIGNED8 * ) hb_parcx( 1 ), diff --git a/harbour/contrib/rddsql/sqlbase.c b/harbour/contrib/rddsql/sqlbase.c index 51f89fc144..510cbd0f35 100644 --- a/harbour/contrib/rddsql/sqlbase.c +++ b/harbour/contrib/rddsql/sqlbase.c @@ -507,8 +507,7 @@ static HB_ERRCODE sqlbaseGoHot( SQLBASEAREAP pArea ) PHB_ITEM pArray, pItem; USHORT us; - pArray = hb_itemNew( NULL ); - hb_arrayNew( pArray, pArea->area.uiFieldCount ); + pArray = hb_itemArrayNew( pArea->area.uiFieldCount ); for ( us = 1; us <= pArea->area.uiFieldCount; us++ ) { pItem = hb_itemNew( NULL ); diff --git a/harbour/contrib/xhb/cstructc.c b/harbour/contrib/xhb/cstructc.c index 30ceea1475..75e2f68850 100644 --- a/harbour/contrib/xhb/cstructc.c +++ b/harbour/contrib/xhb/cstructc.c @@ -1203,7 +1203,7 @@ static PHB_ITEM StructureToArray( BYTE* Buffer, unsigned long ulBufferLen, PHB_I else if( !bAdoptNested ) { /* TraceLog( NULL, "Static: %s\n", *( (char **) ( Buffer + uiOffset ) ) ); */ - hb_itemPutCStatic( pBaseVar->pItems + ulIndex , *( (char **) ( Buffer + uiOffset ) ) ); + hb_itemPutCConst( pBaseVar->pItems + ulIndex , *( (char **) ( Buffer + uiOffset ) ) ); } else { @@ -1220,7 +1220,7 @@ static PHB_ITEM StructureToArray( BYTE* Buffer, unsigned long ulBufferLen, PHB_I else if( !bAdoptNested ) { /* TraceLog( NULL, "Static: %s\n", *( (char **) ( Buffer + uiOffset ) ) ); */ - hb_itemPutCStatic( pBaseVar->pItems + ulIndex , *( (char **) ( Buffer + uiOffset ) ) ); + hb_itemPutCConst( pBaseVar->pItems + ulIndex , *( (char **) ( Buffer + uiOffset ) ) ); } else { @@ -1350,7 +1350,7 @@ static PHB_ITEM StructureToArray( BYTE* Buffer, unsigned long ulBufferLen, PHB_I /* TraceLog( NULL, "After Devalue\n" ); */ } - hb_itemForwardValue( pBaseVar->pItems + ulIndex, pStructure ); + hb_itemMove( pBaseVar->pItems + ulIndex, pStructure ); hb_itemRelease( pStructure ); } diff --git a/harbour/contrib/xhb/xhbarr.c b/harbour/contrib/xhb/xhbarr.c index 7babd9e745..c01eaf1b1c 100644 --- a/harbour/contrib/xhb/xhbarr.c +++ b/harbour/contrib/xhb/xhbarr.c @@ -113,8 +113,8 @@ HB_FUNC( ASPLICE ) for( ulIndex = ulStart + 1; ( ulIndex - ulStart ) <= ulRemove; ulIndex++ ) { - hb_itemForwardValue( hb_arrayGetItemPtr( pReturn, ulIndex - ulStart ), - hb_arrayGetItemPtr( pArray, ulIndex ) ); + hb_itemMove( hb_arrayGetItemPtr( pReturn, ulIndex - ulStart ), + hb_arrayGetItemPtr( pArray, ulIndex ) ); } if( hb_pcount() > 3 ) @@ -132,15 +132,15 @@ HB_FUNC( ASPLICE ) /* Shift right BEFORE adding, so that new items will not override existing values. */ for( ulIndex = ulLen; ulIndex && --ulShift; --ulIndex ) { - hb_itemForwardValue( hb_arrayGetItemPtr( pArray, ulIndex + ulMore ), - hb_arrayGetItemPtr( pArray, ulIndex ) ); + hb_itemMove( hb_arrayGetItemPtr( pArray, ulIndex + ulMore ), + hb_arrayGetItemPtr( pArray, ulIndex ) ); } /* Now insert new values into emptied space. */ for( ulIndex = ulStart; ++ulNew <= ulAdd; ulIndex++ ) { - hb_itemForwardValue( hb_arrayGetItemPtr( pArray, ulIndex + 1 ), - hb_param( 3 + ulNew, HB_IT_ANY ) ); + hb_itemMove( hb_arrayGetItemPtr( pArray, ulIndex + 1 ), + hb_param( 3 + ulNew, HB_IT_ANY ) ); } } else @@ -148,7 +148,7 @@ HB_FUNC( ASPLICE ) /* Insert over the space emptied by removed items */ for( ulIndex = ulStart; ++ulNew <= ulAdd; ulIndex++ ) { - hb_itemForwardValue( hb_arrayGetItemPtr( pArray, ulIndex + 1 ), hb_param( 3 + ulNew, HB_IT_ANY ) ); + hb_itemMove( hb_arrayGetItemPtr( pArray, ulIndex + 1 ), hb_param( 3 + ulNew, HB_IT_ANY ) ); } if( ulRemove > ulAdd ) @@ -158,8 +158,8 @@ HB_FUNC( ASPLICE ) /* Shift left to compact the emptied hole. */ for( ulIndex = ulStart + ulAdd + 1; ulIndex + ulRemove <= ulLen; ulIndex++ ) { - hb_itemForwardValue( hb_arrayGetItemPtr( pArray, ulIndex ), - hb_arrayGetItemPtr( pArray, ulIndex + ulRemove ) ); + hb_itemMove( hb_arrayGetItemPtr( pArray, ulIndex ), + hb_arrayGetItemPtr( pArray, ulIndex + ulRemove ) ); } } } @@ -168,8 +168,8 @@ HB_FUNC( ASPLICE ) { for( ulIndex = ulStart + 1; ulIndex + ulRemove <= ulLen; ulIndex++ ) { - hb_itemForwardValue( hb_arrayGetItemPtr( pArray, ulIndex ), - hb_arrayGetItemPtr( pArray, ulIndex + ulRemove ) ); + hb_itemMove( hb_arrayGetItemPtr( pArray, ulIndex ), + hb_arrayGetItemPtr( pArray, ulIndex + ulRemove ) ); } hb_arraySize( pArray, ulLen - ulRemove ); @@ -209,8 +209,8 @@ HB_FUNC( AMERGE ) /* Shift right BEFORE merging, so that merged items will not override existing values. */ for( ulIndex = ulLen; ulIndex > ulStart; --ulIndex ) { - hb_itemForwardValue( hb_arrayGetItemPtr( pArray1, ulIndex + ulAdd ), - hb_arrayGetItemPtr( pArray1, ulIndex ) ); + hb_itemMove( hb_arrayGetItemPtr( pArray1, ulIndex + ulAdd ), + hb_arrayGetItemPtr( pArray1, ulIndex ) ); } } else diff --git a/harbour/contrib/xhb/xhberrc.c b/harbour/contrib/xhb/xhberrc.c index 831061403e..6e8787b404 100644 --- a/harbour/contrib/xhb/xhberrc.c +++ b/harbour/contrib/xhb/xhberrc.c @@ -85,7 +85,7 @@ LONG WINAPI PRGUnhandledExceptionFilter( EXCEPTION_POINTERS *ExceptionInfo ) HB_ITEM_NEW( Buffer ); HB_ITEM Adopt; - hb_itemForwardValue( &Exception, hb_stackReturnItem() ); + hb_itemMove( &Exception, hb_stackReturnItem() ); hb_itemPutCLStatic( &Buffer, (char *) ExceptionInfo, sizeof( EXCEPTION_POINTERS ) ); diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 585349a319..1c4a4a738b 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -703,14 +703,16 @@ extern HB_EXPORT void hb_retnlllen( LONGLONG lNumber, int iWidth ); /* returns #define HB_IS_VALID_INDEX( idx, max ) ( (idx) > 0 && ( ULONG ) (idx) <= (max) ) -/* xHarbour compatible functions */ -#define hb_retcAdopt( szText ) hb_retc_buffer( (szText) ) -#define hb_retclenAdopt( szText, ulLen ) hb_retclen_buffer( (szText), (ulLen) ) -#define hb_retcStatic( szText ) hb_retc_const( (szText) ) -#define hb_storclenAdopt hb_storclen_buffer -#define hb_itemPutCRawStatic hb_itemPutCLConst -/* compatibility with older Harbour */ -#define hb_arraySetCPtr hb_arraySetCLPtr +#ifdef HB_LEGACY_LEVEL2 + /* xHarbour compatible functions */ + #define hb_retcAdopt( szText ) hb_retc_buffer( (szText) ) + #define hb_retclenAdopt( szText, ulLen ) hb_retclen_buffer( (szText), (ulLen) ) + #define hb_retcStatic( szText ) hb_retc_const( (szText) ) + #define hb_storclenAdopt hb_storclen_buffer + #define hb_itemPutCRawStatic hb_itemPutCLConst + /* compatibility with older Harbour */ + #define hb_arraySetCPtr hb_arraySetCLPtr +#endif #ifdef HB_API_MACROS diff --git a/harbour/include/hbapiitm.h b/harbour/include/hbapiitm.h index fc84b288c8..f3ded23b63 100644 --- a/harbour/include/hbapiitm.h +++ b/harbour/include/hbapiitm.h @@ -210,9 +210,11 @@ extern HB_EXPORT PHB_ITEM hb_itemDeserialize( const char ** pBufferPtr, ULON #endif /* _HB_API_INTERNAL_ */ -/* xHarbour compatible function */ -#define hb_itemForwardValue( dst, src ) hb_itemMove( (dst), (src) ) -#define hb_itemPutCStatic( itm, str ) hb_itemPutCConst( (itm), (str) ) +#ifdef HB_LEGACY_LEVEL2 + /* xHarbour compatible function */ + #define hb_itemForwardValue( dst, src ) hb_itemMove( (dst), (src) ) + #define hb_itemPutCStatic( itm, str ) hb_itemPutCConst( (itm), (str) ) +#endif HB_EXTERN_END diff --git a/harbour/src/debug/dbgentry.c b/harbour/src/debug/dbgentry.c index 0b468a3dfa..0c842e6f28 100644 --- a/harbour/src/debug/dbgentry.c +++ b/harbour/src/debug/dbgentry.c @@ -981,7 +981,7 @@ static PHB_ITEM hb_dbgEvalMacro( const char *szExpr, PHB_ITEM pItem ) } hb_vmPushString( szExpr, strlen( szExpr ) ); hb_macroGetValue( hb_stackItemFromTop( -1 ), 0, HB_SM_RT_MACRO ); - hb_itemForwardValue( pItem, hb_stackItemFromTop( -1 ) ); + hb_itemMove( pItem, hb_stackItemFromTop( -1 ) ); hb_stackPop(); return pItem; } diff --git a/harbour/src/vm/arrays.c b/harbour/src/vm/arrays.c index ffc35858c6..8503525c7c 100644 --- a/harbour/src/vm/arrays.c +++ b/harbour/src/vm/arrays.c @@ -354,7 +354,7 @@ BOOL hb_arrayAddForward( PHB_ITEM pArray, PHB_ITEM pValue ) { hb_arraySize( pArray, pBaseArray->ulLen + 1 ); pBaseArray = ( PHB_BASEARRAY ) pArray->item.asArray.value; - hb_itemForwardValue( pBaseArray->pItems + ( pBaseArray->ulLen - 1 ), pValue ); + hb_itemMove( pBaseArray->pItems + ( pBaseArray->ulLen - 1 ), pValue ); return TRUE; }