From 23f404474884702180bbcd63f5d516fb3efac355 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 31 Aug 2008 15:00:17 +0000 Subject: [PATCH] 2008-08-31 16:59 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * hbwhat32/whtdate.c * hbwhat32/whthead.c * hbwhat32/whtbrsh.c * hbwhat32/whtgdi.c * hbwhat32/whtmisc.c * hbwhat32/whttab.c * hbwhat32/whtbmp.c * hbwhat32/whtkbrd.c % Using hb_arraySet*() instead of hb_arraySet() --- harbour/ChangeLog | 11 +++ harbour/contrib/hbwhat32/whtbmp.c | 56 +++-------- harbour/contrib/hbwhat32/whtbrsh.c | 42 +++----- harbour/contrib/hbwhat32/whtdate.c | 154 +++++++---------------------- harbour/contrib/hbwhat32/whtgdi.c | 67 +++---------- harbour/contrib/hbwhat32/whthead.c | 10 +- harbour/contrib/hbwhat32/whtkbrd.c | 19 ++-- harbour/contrib/hbwhat32/whtmisc.c | 76 ++++++-------- harbour/contrib/hbwhat32/whttab.c | 23 +---- 9 files changed, 138 insertions(+), 320 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f9b2ecded2..f3ac5a1726 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-08-31 16:59 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * hbwhat32/whtdate.c + * hbwhat32/whthead.c + * hbwhat32/whtbrsh.c + * hbwhat32/whtgdi.c + * hbwhat32/whtmisc.c + * hbwhat32/whttab.c + * hbwhat32/whtbmp.c + * hbwhat32/whtkbrd.c + % Using hb_arraySet*() instead of hb_arraySet() + 2008-08-31 16:26 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * utils/hbdoc/bld_vc.bat * utils/hbmake/bld_vc.bat diff --git a/harbour/contrib/hbwhat32/whtbmp.c b/harbour/contrib/hbwhat32/whtbmp.c index 01481b015d..a44a3a2f85 100644 --- a/harbour/contrib/hbwhat32/whtbmp.c +++ b/harbour/contrib/hbwhat32/whtbmp.c @@ -76,23 +76,16 @@ HB_FUNC( DRAWBITMAP ) HB_FUNC( GETBITMAPSIZE ) { - PHB_ITEM aArray = hb_itemArrayNew(2) ; - PHB_ITEM tmp ; + PHB_ITEM aArray = hb_itemArrayNew( 2 ); BITMAP bm; - HBITMAP hBmp = (HBITMAP) hb_parnl(1); + HBITMAP hBmp = ( HBITMAP ) hb_parnl( 1 ); - GetObject(hBmp, sizeof(bm), &bm); + GetObject( hBmp, sizeof( bm ), &bm ); - tmp = hb_itemPutNL( NULL, bm.bmWidth ); - hb_arraySet( aArray, 1, tmp ); - hb_itemRelease( tmp ); + hb_arraySetNL( aArray, 1, bm.bmWidth ); + hb_arraySetNL( aArray, 2, bm.bmHeight ); - tmp = hb_itemPutNL( NULL, bm.bmHeight ); - hb_arraySet( aArray, 2, tmp ); - hb_itemRelease( tmp ); - - hb_itemReturn( aArray ); - hb_itemRelease( aArray ); + hb_itemReturnRelease( aArray ); } //----------------------------------------------------------------------------- @@ -103,16 +96,10 @@ HB_FUNC( GETBITMAPSIZE ) HB_FUNC( GETBITMAPDIMENSIONEX ) { - SIZE Size ; - PHB_ITEM aSize ; - - if ( GetBitmapDimensionEx( (HBITMAP) hb_parnl( 1 ), &Size ) ) - { - aSize = Size2Array( &Size ) ; - hb_itemReturn( aSize ); - hb_itemRelease( aSize ); - } + SIZE Size; + if( GetBitmapDimensionEx( ( HBITMAP ) hb_parnl( 1 ), &Size ) ) + hb_itemReturnRelease( Size2Array( &Size ) ); } @@ -125,9 +112,7 @@ HB_FUNC( GETBITMAPDIMENSIONEX ) HB_FUNC( SETBITMAPDIMENSIONEX ) { - SIZE Size ; - PHB_ITEM aSize; - PHB_ITEM temp; + SIZE Size; if ( SetBitmapDimensionEx( (HBITMAP) hb_parnl( 1 ), hb_parni( 2 ) , @@ -135,21 +120,12 @@ HB_FUNC( SETBITMAPDIMENSIONEX ) &Size ) ) { - - aSize = hb_itemArrayNew(2); - - temp = hb_itemPutNL( NULL, Size.cx ); - hb_arraySet( aSize, 1, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, Size.cy ); - hb_arraySet( aSize, 2, temp ); - hb_itemRelease( temp ); - - hb_itemReturn( aSize ); - hb_itemRelease( aSize ); - - + PHB_ITEM aSize = hb_itemArrayNew( 2 ); + + hb_arraySetNL( aSize, 1, Size.cx ); + hb_arraySetNL( aSize, 2, Size.cy ); + + hb_itemReturnRelease( aSize ); } } diff --git a/harbour/contrib/hbwhat32/whtbrsh.c b/harbour/contrib/hbwhat32/whtbrsh.c index b34d111331..5947041c73 100644 --- a/harbour/contrib/hbwhat32/whtbrsh.c +++ b/harbour/contrib/hbwhat32/whtbrsh.c @@ -138,24 +138,16 @@ HB_FUNC( FIXBRUSHORGEX ) HB_FUNC( GETBRUSHORGEX ) { - POINT Point ; - PHB_ITEM aPt; - PHB_ITEM temp ; + POINT Point; - if ( GetBrushOrgEx( (HDC) hb_parnl( 1 ), &Point ) ) + if( GetBrushOrgEx( ( HDC ) hb_parnl( 1 ), &Point ) ) { - aPt = hb_itemArrayNew( 2 ); + PHB_ITEM aPt = hb_itemArrayNew( 2 ); - temp = hb_itemPutNL( NULL, Point.x ); - hb_arraySet( aPt, 1, temp ); - hb_itemRelease( temp ); + hb_arraySetNL( aPt, 1, Point.x ); + hb_arraySetNL( aPt, 2, Point.y ); - temp = hb_itemPutNL( NULL, Point.y ); - hb_arraySet( aPt, 2, temp ); - hb_itemRelease( temp ); - - hb_itemReturn( aPt ); - hb_itemRelease( aPt ); + hb_itemReturnRelease( aPt ); } } @@ -169,27 +161,17 @@ HB_FUNC( GETBRUSHORGEX ) HB_FUNC( SETBRUSHORGEX ) { - POINT Point ; - PHB_ITEM aPt; - PHB_ITEM temp ; + POINT Point; - if ( SetBrushOrgEx( (HDC) hb_parnl( 1 ), hb_parni( 2 ), hb_parni( 3 ), &Point) ) + if( SetBrushOrgEx( ( HDC ) hb_parnl( 1 ), hb_parni( 2 ), hb_parni( 3 ), &Point ) ) { - aPt = hb_itemArrayNew( 2 ); + PHB_ITEM aPt = hb_itemArrayNew( 2 ); - temp = hb_itemPutNL( NULL, Point.x ); - hb_arraySet( aPt, 1, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, Point.y ); - hb_arraySet( aPt, 2, temp ); - hb_itemRelease( temp ); - - hb_itemReturn( aPt ); - hb_itemRelease( aPt ); + hb_arraySetNL( aPt, 1, Point.x ); + hb_arraySetNL( aPt, 2, Point.y ); + hb_itemReturnRelease( aPt ); } - } diff --git a/harbour/contrib/hbwhat32/whtdate.c b/harbour/contrib/hbwhat32/whtdate.c index fb186cd97c..410a24761c 100644 --- a/harbour/contrib/hbwhat32/whtdate.c +++ b/harbour/contrib/hbwhat32/whtdate.c @@ -113,97 +113,47 @@ HB_FUNC( DATETIME_GETMONTHCALFONT ) HB_FUNC( DATETIME_GETRANGE ) { - LPSYSTEMTIME lpSysTimeArray = (SYSTEMTIME *) hb_xgrab( 2 * sizeof(SYSTEMTIME)) ; - PHB_ITEM aMinMaxDate, aMinDate, aMaxDate ; - PHB_ITEM temp ; - DWORD dwRet ; + LPSYSTEMTIME lpSysTimeArray = (SYSTEMTIME *) hb_xgrab( 2 * sizeof(SYSTEMTIME)); + PHB_ITEM aMinMaxDate, aMinDate, aMaxDate; + DWORD dwRet; - dwRet = DateTime_GetRange( (HWND) hb_parnl( 1 ), (SYSTEMTIME *)lpSysTimeArray ) ; + dwRet = DateTime_GetRange( (HWND) hb_parnl( 1 ), (SYSTEMTIME *)lpSysTimeArray ); - if ( ISBYREF(2) ) - hb_stornl(dwRet,2); + if( ISBYREF( 2 ) ) + hb_stornl( dwRet, 2 ); + aMinMaxDate = hb_itemArrayNew( 2 ); - aMinMaxDate = hb_itemArrayNew( 2 ) ; - aMinDate = hb_itemArrayNew( 8 ) ; - - temp = hb_itemPutNL( NULL, lpSysTimeArray[0].wYear ); - hb_arraySet( aMinDate, 1, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[0].wMonth ); - hb_arraySet( aMinDate, 2, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[0].wDayOfWeek ); - hb_arraySet( aMinDate, 3, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[0].wDay ); - hb_arraySet( aMinDate, 4, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[0].wHour ); - hb_arraySet( aMinDate, 5, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[0].wMinute ); - hb_arraySet( aMinDate, 6, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[0].wSecond ); - hb_arraySet( aMinDate, 7, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[0].wMilliseconds ); - hb_arraySet( aMinDate, 8, temp ); - hb_itemRelease( temp ); + aMinDate = hb_itemArrayNew( 8 ); + hb_arraySetNL( aMinDate, 1, lpSysTimeArray[0].wYear ); + hb_arraySetNL( aMinDate, 2, lpSysTimeArray[0].wMonth ); + hb_arraySetNL( aMinDate, 3, lpSysTimeArray[0].wDayOfWeek ); + hb_arraySetNL( aMinDate, 4, lpSysTimeArray[0].wDay ); + hb_arraySetNL( aMinDate, 5, lpSysTimeArray[0].wHour ); + hb_arraySetNL( aMinDate, 6, lpSysTimeArray[0].wMinute ); + hb_arraySetNL( aMinDate, 7, lpSysTimeArray[0].wSecond ); + hb_arraySetNL( aMinDate, 8, lpSysTimeArray[0].wMilliseconds ); hb_arraySet( aMinMaxDate, 1, aMinDate ); - aMaxDate = hb_itemArrayNew( 8 ) ; - - temp = hb_itemPutNL( NULL, lpSysTimeArray[1].wYear ); - hb_arraySet( aMaxDate, 1, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[1].wMonth ); - hb_arraySet( aMaxDate, 2, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[1].wDayOfWeek ); - hb_arraySet( aMaxDate, 3, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[1].wDay ); - hb_arraySet( aMaxDate, 4, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[1].wHour ); - hb_arraySet( aMaxDate, 5, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[1].wMinute ); - hb_arraySet( aMaxDate, 6, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[1].wSecond ); - hb_arraySet( aMaxDate, 7, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, lpSysTimeArray[1].wMilliseconds ); - hb_arraySet( aMaxDate, 8, temp ); - hb_itemRelease( temp ); + aMaxDate = hb_itemArrayNew( 8 ); + hb_arraySetNL( aMaxDate, 1, lpSysTimeArray[1].wYear ); + hb_arraySetNL( aMaxDate, 2, lpSysTimeArray[1].wMonth ); + hb_arraySetNL( aMaxDate, 3, lpSysTimeArray[1].wDayOfWeek ); + hb_arraySetNL( aMaxDate, 4, lpSysTimeArray[1].wDay ); + hb_arraySetNL( aMaxDate, 5, lpSysTimeArray[1].wHour ); + hb_arraySetNL( aMaxDate, 6, lpSysTimeArray[1].wMinute ); + hb_arraySetNL( aMaxDate, 7, lpSysTimeArray[1].wSecond ); + hb_arraySetNL( aMaxDate, 8, lpSysTimeArray[1].wMilliseconds ); hb_arraySet( aMinMaxDate, 2, aMaxDate ); - hb_itemReturn( aMinMaxDate ); - hb_itemRelease( aMinMaxDate ); + hb_itemReturnRelease( aMinMaxDate ); hb_itemRelease( aMinDate ); hb_itemRelease( aMaxDate ); - hb_xfree(lpSysTimeArray); + hb_xfree(lpSysTimeArray); } //----------------------------------------------------------------------------- @@ -221,12 +171,9 @@ HB_FUNC( DATETIME_GETRANGE ) HB_FUNC( DATETIME_GETSYSTEMTIME ) { - SYSTEMTIME SysTime ; - PHB_ITEM aSysTime ; - PHB_ITEM temp ; + SYSTEMTIME SysTime; long nRet; - nRet = DateTime_GetSystemtime( (HWND) hb_parnl( 1 ), // Handle to a DTP control &SysTime // Pointer to a SYSTEMTIME structure. If DTM_GETSYSTEMTIME returns @@ -237,44 +184,19 @@ HB_FUNC( DATETIME_GETSYSTEMTIME ) if (nRet == GDT_VALID) // Time is valid { - aSysTime = hb_itemArrayNew( 8 ) ; + PHB_ITEM aSysTime = hb_itemArrayNew( 8 ); - temp = hb_itemPutNL( NULL, SysTime.wYear ); - hb_arraySet( aSysTime, 1, temp ); - hb_itemRelease( temp ); + hb_arraySetNL( aSysTime, 1, SysTime.wYear ); + hb_arraySetNL( aSysTime, 2, SysTime.wMonth ); + hb_arraySetNL( aSysTime, 3, SysTime.wDayOfWeek ); + hb_arraySetNL( aSysTime, 4, SysTime.wDay ); + hb_arraySetNL( aSysTime, 5, SysTime.wHour ); + hb_arraySetNL( aSysTime, 6, SysTime.wMinute ); + hb_arraySetNL( aSysTime, 7, SysTime.wSecond ); + hb_arraySetNL( aSysTime, 8, SysTime.wMilliseconds ); - temp = hb_itemPutNL( NULL, SysTime.wMonth ); - hb_arraySet( aSysTime, 2, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, SysTime.wDayOfWeek ); - hb_arraySet( aSysTime, 3, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, SysTime.wDay ); - hb_arraySet( aSysTime, 4, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, SysTime.wHour ); - hb_arraySet( aSysTime, 5, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, SysTime.wMinute ); - hb_arraySet( aSysTime, 6, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, SysTime.wSecond ); - hb_arraySet( aSysTime, 7, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, SysTime.wMilliseconds ); - hb_arraySet( aSysTime, 8, temp ); - hb_itemRelease( temp ); - - hb_itemReturn( aSysTime ); - hb_itemRelease( aSysTime ); + hb_itemReturnRelease( aSysTime ); } - } //----------------------------------------------------------------------------- diff --git a/harbour/contrib/hbwhat32/whtgdi.c b/harbour/contrib/hbwhat32/whtgdi.c index 2722ec6851..e3ed4bee81 100644 --- a/harbour/contrib/hbwhat32/whtgdi.c +++ b/harbour/contrib/hbwhat32/whtgdi.c @@ -795,61 +795,24 @@ HB_FUNC( DRAGDETECT ) HB_FUNC( GETDRAWITEMSTRUCT ) { - DRAWITEMSTRUCT *dis =(DRAWITEMSTRUCT*) hb_parnl( 1 ) ; + DRAWITEMSTRUCT * dis = ( DRAWITEMSTRUCT * ) hb_parnl( 1 ); - PHB_ITEM arrDis = hb_itemArrayNew(12) ; - PHB_ITEM temp ; + PHB_ITEM arrDis = hb_itemArrayNew( 12 ); - temp = hb_itemPutNL( NULL, dis->CtlType ); - hb_arraySet( arrDis, 1, temp ); - hb_itemRelease( temp ); + hb_arraySetNL( arrDis, 1, dis->CtlType ); + hb_arraySetNL( arrDis, 2, dis->CtlID ); + hb_arraySetNL( arrDis, 3, dis->itemID ); + hb_arraySetNL( arrDis, 4, dis->itemAction ); + hb_arraySetNL( arrDis, 5, dis->itemState ); + hb_arraySetNL( arrDis, 6, ( LONG ) dis->hwndItem ); + hb_arraySetNL( arrDis, 7, ( LONG ) dis->hDC ); + hb_arraySetNL( arrDis, 8, dis->rcItem.left ); + hb_arraySetNL( arrDis, 9, dis->rcItem.top ); + hb_arraySetNL( arrDis, 10, dis->rcItem.right ); + hb_arraySetNL( arrDis, 11, dis->rcItem.bottom ); + hb_arraySetNL( arrDis, 12, dis->itemData ); - temp = hb_itemPutNL( NULL, dis->CtlID ); - hb_arraySet( arrDis, 2, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, dis->itemID ); - hb_arraySet( arrDis, 3, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, dis->itemAction ); - hb_arraySet( arrDis, 4, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, dis->itemState ); - hb_arraySet( arrDis, 5, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, (LONG) dis->hwndItem ); - hb_arraySet( arrDis, 6, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, (LONG) dis->hDC ); - hb_arraySet( arrDis, 7, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, dis->rcItem.left ); - hb_arraySet( arrDis, 8, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, dis->rcItem.top ); - hb_arraySet( arrDis, 9, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, dis->rcItem.right ); - hb_arraySet( arrDis, 10, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, dis->rcItem.bottom ); - hb_arraySet( arrDis, 11, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, dis->itemData ); - hb_arraySet( arrDis, 12, temp ); - hb_itemRelease( temp ); - - hb_itemReturn( arrDis ); - hb_itemRelease( arrDis ); + hb_itemReturnRelease( arrDis ); } diff --git a/harbour/contrib/hbwhat32/whthead.c b/harbour/contrib/hbwhat32/whthead.c index 9b25fa819f..8031b0e568 100644 --- a/harbour/contrib/hbwhat32/whthead.c +++ b/harbour/contrib/hbwhat32/whthead.c @@ -121,7 +121,6 @@ HB_FUNC( HEADER_GETORDERARRAY ) UINT iCount = Header_GetItemCount((HWND)hb_parnl(1) ); PHB_ITEM aInt ; - PHB_ITEM temp ; INT *lpi = (INT*) hb_xgrab( iCount*sizeof(INT)) ; BOOL lRet = Header_GetOrderArray((HWND) hb_parnl(1), iCount, lpi ) ; UINT i; @@ -130,14 +129,9 @@ HB_FUNC( HEADER_GETORDERARRAY ) { aInt = hb_itemArrayNew(iCount ) ; for ( i = 0; i 0 ) ) @@ -264,7 +263,7 @@ HB_FUNC( COPYACCELERATORTABLE ) iRet = CopyAcceleratorTable( (HACCEL) hb_parnl( 1 ) , (iCount==0 ? NULL : lpAccelDst ) , iCount - ) ; + ); if ( ( iCount > 0 ) && (iRet > 0 ) ) { @@ -273,21 +272,19 @@ HB_FUNC( COPYACCELERATORTABLE ) aParam = hb_param( 2, HB_IT_ARRAY ) ; aSub = hb_itemArrayNew( 3 ) ; - item = hb_itemNew( NULL ) ; for ( i = 0 ; i < iCount ; i++ ) { - hb_arraySet( aSub, 1, hb_itemPutNI( item, lpAccelDst->fVirt ) ) ; - hb_arraySet( aSub, 2, hb_itemPutNI( item, lpAccelDst->key ) ) ; - hb_arraySet( aSub, 3, hb_itemPutNI( item, lpAccelDst->cmd ) ) ; - hb_arraySet( aParam, i+1, hb_arrayClone(aSub) ) ; + hb_arraySetNI( aSub, 1, lpAccelDst->fVirt ); + hb_arraySetNI( aSub, 2, lpAccelDst->key ); + hb_arraySetNI( aSub, 3, lpAccelDst->cmd ); + hb_arraySet( aParam, i + 1, hb_arrayClone( aSub ) ); } - hb_itemRelease(item) ; - hb_itemRelease(aSub) ; + hb_itemRelease( aSub ); } - if ( iCount > 0 ) + if( iCount > 0 ) hb_xfree( lpAccelDst ); - hb_retni( iRet ) ; + hb_retni( iRet ); } diff --git a/harbour/contrib/hbwhat32/whtmisc.c b/harbour/contrib/hbwhat32/whtmisc.c index e9db6c01c1..236348dc91 100644 --- a/harbour/contrib/hbwhat32/whtmisc.c +++ b/harbour/contrib/hbwhat32/whtmisc.c @@ -199,16 +199,15 @@ BOOL Array2Rect(PHB_ITEM aRect, RECT *rc ) // Not API - internal use -PHB_ITEM Rect2Array( RECT *rc ) +PHB_ITEM Rect2Array( RECT * rc ) { - PHB_ITEM aRect = hb_itemArrayNew(4); - PHB_ITEM element = hb_itemNew(NULL); + PHB_ITEM aRect = hb_itemArrayNew( 4 ); + + hb_arraySetNL( aRect, 1, rc->left ); + hb_arraySetNL( aRect, 2, rc->top ); + hb_arraySetNL( aRect, 3, rc->right ); + hb_arraySetNL( aRect, 4, rc->bottom ); - hb_arraySet(aRect, 1, hb_itemPutNL(element, rc->left)); - hb_arraySet(aRect, 2, hb_itemPutNL(element, rc->top)); - hb_arraySet(aRect, 3, hb_itemPutNL(element, rc->right)); - hb_arraySet(aRect, 4, hb_itemPutNL(element, rc->bottom)); - hb_itemRelease(element); return aRect; } @@ -259,14 +258,13 @@ BOOL Array2Point(PHB_ITEM aPoint, POINT *pt ) // Not API - internal use -PHB_ITEM Point2Array( POINT *pt ) +PHB_ITEM Point2Array( POINT * pt ) { - PHB_ITEM aPoint = hb_itemArrayNew(2); - PHB_ITEM element = hb_itemNew(NULL); + PHB_ITEM aPoint = hb_itemArrayNew( 2 ); + + hb_arraySetNL( aPoint, 1, pt->x ); + hb_arraySetNL( aPoint, 2, pt->y ); - hb_arraySet(aPoint, 1, hb_itemPutNL(element, pt->x)); - hb_arraySet(aPoint, 2, hb_itemPutNL(element, pt->y)); - hb_itemRelease(element); return aPoint; } @@ -274,10 +272,11 @@ PHB_ITEM Point2Array( POINT *pt ) BOOL Array2Size(PHB_ITEM aSize, SIZE *siz ) { - if (HB_IS_ARRAY(aSize) && hb_arrayLen(aSize) == 2) { + if( HB_IS_ARRAY( aSize ) && hb_arrayLen( aSize ) == 2 ) + { siz->cx = hb_arrayGetNL(aSize,1); siz->cy = hb_arrayGetNL(aSize,2); - return TRUE ; + return TRUE; } return FALSE; } @@ -311,14 +310,13 @@ BOOL Array2Size(PHB_ITEM aSize, SIZE *siz ) // Not API - internal use -PHB_ITEM Size2Array( SIZE *siz ) +PHB_ITEM Size2Array( SIZE * siz ) { - PHB_ITEM aSize = hb_itemArrayNew(2); - PHB_ITEM element = hb_itemNew(NULL); + PHB_ITEM aSize = hb_itemArrayNew( 2 ); + + hb_arraySetNL( aSize, 1, siz->cx ); + hb_arraySetNL( aSize, 2, siz->cy ); - hb_arraySet(aSize, 1, hb_itemPutNL(element, siz->cx)); - hb_arraySet(aSize, 2, hb_itemPutNL(element, siz->cy)); - hb_itemRelease(element); return aSize; } @@ -651,38 +649,26 @@ HB_FUNC( ATAN ) //----------------------------------------------------------------------------- /* Extended function for Array CopyRight Luiz Rafael Culik Guimaraes Culikr@uol.com.br */ -void Rect2ArrayEx( RECT *rc ,PHB_ITEM aRect ) +void Rect2ArrayEx( RECT * rc, PHB_ITEM aRect ) { - PHB_ITEM element = hb_itemNew(NULL); - - hb_arraySet(aRect, 1, hb_itemPutNL(element, rc->left)); - hb_arraySet(aRect, 2, hb_itemPutNL(element, rc->top)); - hb_arraySet(aRect, 3, hb_itemPutNL(element, rc->right)); - hb_arraySet(aRect, 4, hb_itemPutNL(element, rc->bottom)); - hb_itemRelease(element); + hb_arraySetNL( aRect, 1, rc->left ); + hb_arraySetNL( aRect, 2, rc->top ); + hb_arraySetNL( aRect, 3, rc->right ); + hb_arraySetNL( aRect, 4, rc->bottom ); } //----------------------------------------------------------------------------- -void Point2ArrayEx( POINT *pt , PHB_ITEM aPoint) +void Point2ArrayEx( POINT *pt, PHB_ITEM aPoint ) { - - PHB_ITEM element = hb_itemNew(NULL); - - hb_arraySet(aPoint, 1, hb_itemPutNL(element, pt->x)); - hb_arraySet(aPoint, 2, hb_itemPutNL(element, pt->y)); - hb_itemRelease(element); - + hb_arraySetNL( aPoint, 1, pt->x ); + hb_arraySetNL( aPoint, 2, pt->y ); } //----------------------------------------------------------------------------- -void Size2ArrayEx( SIZE *siz ,PHB_ITEM aSize ) +void Size2ArrayEx( SIZE * siz, PHB_ITEM aSize ) { - PHB_ITEM element = hb_itemNew(NULL); - - hb_arraySet(aSize, 1, hb_itemPutNL(element, siz->cx)); - hb_arraySet(aSize, 2, hb_itemPutNL(element, siz->cy)); - hb_itemRelease(element); - + hb_arraySetNL( aSize, 1, siz->cx ); + hb_arraySetNL( aSize, 2, siz->cy ); } diff --git a/harbour/contrib/hbwhat32/whttab.c b/harbour/contrib/hbwhat32/whttab.c index dbbbd2bc63..0dd4c5b523 100644 --- a/harbour/contrib/hbwhat32/whttab.c +++ b/harbour/contrib/hbwhat32/whttab.c @@ -97,28 +97,15 @@ HB_FUNC( TABCTRL_GETITEMRECT ) { RECT rc; PHB_ITEM aRect = hb_itemArrayNew( 4 ); - PHB_ITEM temp; TabCtrl_GetItemRect((HWND) hb_parnl (1), hb_parni(2), &rc); - temp = hb_itemPutNL( NULL, rc.left ); - hb_arraySet( aRect, 1, temp ); - hb_itemRelease( temp ); + hb_arraySetNL( aRect, 1, rc.left ); + hb_arraySetNL( aRect, 2, rc.top ); + hb_arraySetNL( aRect, 3, rc.right ); + hb_arraySetNL( aRect, 4, rc.bottom ); - temp = hb_itemPutNL( NULL, rc.top ); - hb_arraySet( aRect, 2, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, rc.right ); - hb_arraySet( aRect, 3, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, rc.bottom ); - hb_arraySet( aRect, 4, temp ); - hb_itemRelease( temp ); - - hb_itemReturn( aRect ); - hb_itemRelease( aRect ); + hb_itemReturnRelease( aRect ); } //---------------------------------------------------------------------------//