diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9da97df3f7..40b2a712e4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,30 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-10 18:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * include/hbgtcore.h + * include/hbapigt.h + * source/rtl/gtapi.c + * source/rtl/hbgtcore.c + * contrib/hbct/ctwin.c + * contrib/hbct/screen1.c + * contrib/hbct/ctwfunc.c + * GetClearChar/SetClearChar changed to use USHORT for char + (was int). This resolves all remaining MSVC warnings. + * _HB_GT_BASE structure adapted to latest changes, three + vars changed from USHORT to int, one renamed to reflect + int type. + + Added var names to a few functions declarations. + % Minor optimizations. + * hb_gtScrollEx() modified to not do parameter evaluation, + just pass them to low-level. + ; Przemek, please review me, I've again encountered UCHARs + in hbct / SETCLEARB(). + + * source/rtl/idle.c + * SHORT -> int. + * Minor formatting. + 2009-07-10 09:32 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbxbp/Makefile + harbour/contrib/hbxbp/xbpdev.ch @@ -33,11 +57,11 @@ + Started XbpPresSpace() class - skeleton only. + harbour/contrib/hbxbp/xbpprintdialog.prg - + Implemented XbpPrintDialog() class. + + Implemented XbpPrintDialog() class. Mostly working but has some differences with Xbase++ - a work-in-progress. + harbour/contrib/hbxbp/xbpprinter.prg - + Implemented XbpPrinter() class. + + Implemented XbpPrinter() class. Mostly working but has some differences with Xbase++ - a work-in-progress. Integrated with XbpPrintDialog() @@ -45,14 +69,14 @@ + Demonstration of XbpPrintDialog() and XbpPrinter() classes. Click on toolbar button. - /* I would request Xbase++ users to test the code under different + /* I would request Xbase++ users to test the code under different permutations and combinations and please report the differences. So far I have not received any support in this direction. - */ + */ 2009-07-10 08:19 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbqt/generator/qt45.qtp - + * harbour/contrib/hbqt/hbqt.ch * harbour/contrib/hbqt/hbqt.h * harbour/contrib/hbqt/hbqt_slots.cpp @@ -67,7 +91,7 @@ + harbour/contrib/hbqt/qth/QPrintEngine.qth + harbour/contrib/hbqt/qth/QPrinter.qth - + + Added two more classes. + Added one more event handler. diff --git a/harbour/contrib/hbct/ctwfunc.c b/harbour/contrib/hbct/ctwfunc.c index 7c908fcf83..1dd6ef5909 100644 --- a/harbour/contrib/hbct/ctwfunc.c +++ b/harbour/contrib/hbct/ctwfunc.c @@ -95,16 +95,16 @@ HB_FUNC( SETCLEARA ) HB_FUNC( SETCLEARB ) { - int iNew; + USHORT usNew; if( HB_ISNUM( 1 ) ) - iNew = hb_parni( 1 ); + usNew = ( USHORT ) hb_parni( 1 ); else if( HB_ISCHAR( 1 ) ) - iNew = ( UCHAR ) hb_parc( 1 )[0]; + usNew = ( USHORT ) hb_parc( 1 )[0]; else - iNew = 255; + usNew = 255; - hb_gtSetClearChar( iNew ); + hb_gtSetClearChar( usNew ); hb_retc_null(); } diff --git a/harbour/contrib/hbct/ctwin.c b/harbour/contrib/hbct/ctwin.c index 05446c2bdf..f14487556b 100644 --- a/harbour/contrib/hbct/ctwin.c +++ b/harbour/contrib/hbct/ctwin.c @@ -670,7 +670,7 @@ static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom bAttr = 0; if( iColor < 0 ) iColor = HB_GTSELF_GETCOLOR( pCTW->pGT ); - usChar = ( USHORT ) HB_GTSELF_GETCLEARCHAR( pCTW->pGT ); + usChar = HB_GTSELF_GETCLEARCHAR( pCTW->pGT ); lIndex = 0; for( iRow = pWnd->iFirstRow; iRow < pWnd->iFirstRow + pWnd->iHeight; ++iRow ) @@ -679,7 +679,7 @@ static int hb_ctw_CreateWindow( PHB_GTCTW pCTW, int iTop, int iLeft, int iBottom { if( !fClear && !HB_GTSELF_GETSCRCHAR( pCTW->pGT, iRow, iCol, &iColor, &bAttr, &usChar ) ) { - usChar = ( USHORT ) HB_GTSELF_GETCLEARCHAR( pCTW->pGT ); + usChar = HB_GTSELF_GETCLEARCHAR( pCTW->pGT ); iColor = HB_GTSELF_GETCOLOR( pCTW->pGT ); bAttr = 0; } @@ -1416,7 +1416,7 @@ static void hb_ctw_gt_WriteCon( PHB_GT pGT, const char * pText, ULONG ulLength ) { HB_GTSELF_SCROLL( pGT, 0, 0, iMaxRow, iMaxCol, HB_GTSELF_GETCOLOR( pGT ), - ( USHORT ) HB_GTSELF_GETCLEARCHAR( pGT ), + HB_GTSELF_GETCLEARCHAR( pGT ), iRow - iMaxRow, 0 ); iRow = iMaxRow; iCol = 0; diff --git a/harbour/contrib/hbct/screen1.c b/harbour/contrib/hbct/screen1.c index 81c10635ca..41309b5d83 100644 --- a/harbour/contrib/hbct/screen1.c +++ b/harbour/contrib/hbct/screen1.c @@ -312,7 +312,7 @@ static int hb_ctGetClearChar( int iParam ) else if( HB_ISCHAR( iParam ) ) iChar = ( UCHAR ) hb_parc( iParam )[0]; else - iChar = hb_gtGetClearChar(); + iChar = ( int ) hb_gtGetClearChar(); return iChar; } diff --git a/harbour/include/hbapigt.h b/harbour/include/hbapigt.h index 93a6527052..cf4625c934 100644 --- a/harbour/include/hbapigt.h +++ b/harbour/include/hbapigt.h @@ -227,9 +227,9 @@ extern HB_EXPORT int hb_gtAlert( PHB_ITEM pMessage, PHB_ITEM pOptions, in extern HB_EXPORT int hb_gtSetFlag( int iType, int iNewValue ); extern HB_EXPORT int hb_gtGetCurrColor( void ); extern HB_EXPORT int hb_gtGetClearColor( void ); -extern HB_EXPORT HB_ERRCODE hb_gtSetClearColor( int ); -extern HB_EXPORT int hb_gtGetClearChar( void ); -extern HB_EXPORT HB_ERRCODE hb_gtSetClearChar( int ); +extern HB_EXPORT HB_ERRCODE hb_gtSetClearColor( int iColor ); +extern HB_EXPORT USHORT hb_gtGetClearChar( void ); +extern HB_EXPORT HB_ERRCODE hb_gtSetClearChar( USHORT usChar ); extern HB_EXPORT HB_ERRCODE hb_gtGetScrChar( int iRow, int iCol, int * piColor, BYTE * pbAttr, USHORT * pusChar ); extern HB_EXPORT HB_ERRCODE hb_gtPutScrChar( int iRow, int iCol, int iColor, BYTE bAttr, USHORT usChar ); extern HB_EXPORT HB_ERRCODE hb_gtFlush( void ); diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index 1fe6a19f2e..06b467bcc4 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -116,7 +116,7 @@ typedef struct void (* Exit) ( HB_GT_PTR ); void * (* New) ( HB_GT_PTR ); void (* Free) ( HB_GT_PTR ); - BOOL (* Resize ) ( HB_GT_PTR, int, int ); + BOOL (* Resize) ( HB_GT_PTR, int, int ); BOOL (* SetMode) ( HB_GT_PTR, int, int ); void (* GetSize) ( HB_GT_PTR, int *, int * ); void (* SemiCold) ( HB_GT_PTR ); @@ -145,8 +145,8 @@ typedef struct void (* GetColorData) ( HB_GT_PTR, int **, int *, int * ); int (* GetClearColor) ( HB_GT_PTR ); void (* SetClearColor) ( HB_GT_PTR, int ); - int (* GetClearChar) ( HB_GT_PTR ); - void (* SetClearChar) ( HB_GT_PTR, int ); + USHORT (* GetClearChar) ( HB_GT_PTR ); + void (* SetClearChar) ( HB_GT_PTR, USHORT ); int (* GetCursorStyle) ( HB_GT_PTR ); void (* SetCursorStyle) ( HB_GT_PTR, int ); void (* GetScrCursor) ( HB_GT_PTR, int *, int *, int * ); @@ -295,10 +295,10 @@ typedef struct _HB_GT_BASE BOOL fStdOutCon; BOOL fStdErrCon; int iCursorShape; - USHORT uiDispCount; - USHORT uiExtCount; - USHORT uiClearChar; - USHORT uiClearColor; + int iDispCount; + int iExtCount; + USHORT usClearChar; + int iClearColor; HB_FHANDLE hStdIn; HB_FHANDLE hStdOut; HB_FHANDLE hStdErr; diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 0a3108157f..fe488e87ae 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -1087,7 +1087,7 @@ int hb_gtSetFlag( int iType, int iNewValue ) int hb_gtGetCurrColor( void ) { - int iColor = 0x07; + int iColor; PHB_GT pGT; HB_TRACE(HB_TR_DEBUG, ("hb_gtGetCurrColor()")); @@ -1098,12 +1098,15 @@ int hb_gtGetCurrColor( void ) iColor = HB_GTSELF_GETCOLOR( pGT ); hb_gt_BaseFree( pGT ); } + else + iColor = 0x07; + return iColor; } int hb_gtGetClearColor( void ) { - int iColor = 0x07; + int iColor; PHB_GT pGT; HB_TRACE(HB_TR_DEBUG, ("hb_gtGetClearColor()")); @@ -1114,6 +1117,9 @@ int hb_gtGetClearColor( void ) iColor = HB_GTSELF_GETCLEARCOLOR( pGT ); hb_gt_BaseFree( pGT ); } + else + iColor = 0x07; + return iColor; } @@ -1133,9 +1139,9 @@ HB_ERRCODE hb_gtSetClearColor( int iColor ) return HB_FAILURE; } -int hb_gtGetClearChar( void ) +USHORT hb_gtGetClearChar( void ) { - int iChar = ' '; + USHORT usChar; PHB_GT pGT; HB_TRACE(HB_TR_DEBUG, ("hb_gtGetClearChar()")); @@ -1143,22 +1149,25 @@ int hb_gtGetClearChar( void ) pGT = hb_gt_Base(); if( pGT ) { - iChar = HB_GTSELF_GETCLEARCHAR( pGT ); + usChar = HB_GTSELF_GETCLEARCHAR( pGT ); hb_gt_BaseFree( pGT ); } - return iChar; + else + usChar = ( USHORT ) ' '; + + return usChar; } -HB_ERRCODE hb_gtSetClearChar( int iChar ) +HB_ERRCODE hb_gtSetClearChar( USHORT usChar ) { PHB_GT pGT; - HB_TRACE(HB_TR_DEBUG, ("hb_gtSetClearChar(%d)", iChar)); + HB_TRACE(HB_TR_DEBUG, ("hb_gtSetClearChar(%hu)", usChar)); pGT = hb_gt_Base(); if( pGT ) { - HB_GTSELF_SETCLEARCHAR( pGT, iChar ); + HB_GTSELF_SETCLEARCHAR( pGT, usChar ); hb_gt_BaseFree( pGT ); return HB_SUCCESS; } @@ -1234,24 +1243,24 @@ HB_ERRCODE hb_gtGetPosEx( int * piRow, int * piCol ) HB_ERRCODE hb_gtScrollEx( int iTop, int iLeft, int iBottom, int iRight, int iColor, int iChar, int iRows, int iCols ) { + PHB_GT pGT; + HB_TRACE(HB_TR_DEBUG, ("hb_gtScrollEx(%d, %d, %d, %d, %d, %d, %d, %d)", iTop, iLeft, iBottom, iRight, iColor, iChar, iRows, iCols)); - if( iTop <= iBottom && iLeft <= iRight ) + pGT = hb_gt_Base(); + if( pGT ) { - PHB_GT pGT = hb_gt_Base(); - if( pGT ) - { - if( iColor == -1 ) - iColor = HB_GTSELF_GETCOLOR( pGT ); - if( iChar < 0 ) - iChar = HB_GTSELF_GETCLEARCHAR( pGT ); - HB_GTSELF_SCROLL( pGT, iTop, iLeft, iBottom, iRight, - iColor, iChar, iRows, iCols ); - HB_GTSELF_FLUSH( pGT ); - hb_gt_BaseFree( pGT ); - return HB_SUCCESS; - } + if( iColor == -1 ) + iColor = HB_GTSELF_GETCOLOR( pGT ); + if( iChar < 0 ) + iChar = HB_GTSELF_GETCLEARCHAR( pGT ); + HB_GTSELF_SCROLL( pGT, iTop, iLeft, iBottom, iRight, + iColor, ( USHORT ) iChar, iRows, iCols ); + HB_GTSELF_FLUSH( pGT ); + hb_gt_BaseFree( pGT ); + return HB_SUCCESS; } + return HB_FAILURE; } diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index ee288fbab2..65284b1bfd 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -94,10 +94,10 @@ static void hb_gt_def_BaseInit( PHB_GT_BASE pGT ) pGT->fStdOutCon = FALSE; pGT->fStdErrCon = FALSE; pGT->iCursorShape = SC_NORMAL; - pGT->uiDispCount = 0; - pGT->uiExtCount = 0; - pGT->uiClearChar = ' '; - pGT->uiClearColor = 0x07; + pGT->iDispCount = 0; + pGT->iExtCount = 0; + pGT->usClearChar = ' '; + pGT->iClearColor = 0x07; pGT->iHeight = 24; pGT->iWidth = 80; pGT->hStdIn = HB_STDIN_HANDLE; @@ -307,22 +307,22 @@ static void hb_gt_def_GetColorData( PHB_GT pGT, int ** pColorsPtr, int * piColor static int hb_gt_def_GetClearColor( PHB_GT pGT ) { - return pGT->uiClearColor; + return pGT->iClearColor; } static void hb_gt_def_SetClearColor( PHB_GT pGT, int iColor ) { - pGT->uiClearColor = ( USHORT ) ( iColor & 0xff ); + pGT->iClearColor = ( iColor & 0xFF ); } -static int hb_gt_def_GetClearChar( PHB_GT pGT ) +static USHORT hb_gt_def_GetClearChar( PHB_GT pGT ) { - return pGT->uiClearChar; + return pGT->usClearChar; } -static void hb_gt_def_SetClearChar( PHB_GT pGT, int iChar ) +static void hb_gt_def_SetClearChar( PHB_GT pGT, USHORT usChar ) { - pGT->uiClearChar = ( USHORT ) iChar; + pGT->usClearChar = usChar; } /* helper internal function */ @@ -617,33 +617,33 @@ static void hb_gt_def_SetSnowFlag( PHB_GT pGT, BOOL fNoSnow ) static void hb_gt_def_DispBegin( PHB_GT pGT ) { - pGT->uiDispCount++; + pGT->iDispCount++; } static void hb_gt_def_DispEnd( PHB_GT pGT ) { - if( pGT->uiDispCount > 0 ) - pGT->uiDispCount--; + if( pGT->iDispCount > 0 ) + pGT->iDispCount--; } static int hb_gt_def_DispCount( PHB_GT pGT ) { - return pGT->uiDispCount; + return pGT->iDispCount; } static BOOL hb_gt_def_PreExt( PHB_GT pGT ) { - if( pGT->uiExtCount == 0 ) + if( pGT->iExtCount == 0 ) HB_GTSELF_REFRESH( pGT ); - pGT->uiExtCount++; + pGT->iExtCount++; return TRUE; } static BOOL hb_gt_def_PostExt( PHB_GT pGT ) { - if( pGT->uiExtCount ) - pGT->uiExtCount--; + if( pGT->iExtCount ) + pGT->iExtCount--; return TRUE; } @@ -1291,12 +1291,13 @@ static void hb_gt_def_Box( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRi iLeft = iRight; iRight = i; } - iMaxRow = HB_GTSELF_MAXROW( pGT ), iMaxCol = HB_GTSELF_MAXCOL( pGT ); + iMaxRow = HB_GTSELF_MAXROW( pGT ); + iMaxCol = HB_GTSELF_MAXCOL( pGT ); if( iTop <= iMaxRow && iLeft <= iMaxCol && iBottom >= 0 && iRight >= 0 ) { char szBox[ 10 ]; - char cPadCh = HB_GTSELF_GETCLEARCHAR( pGT ); + char cPadCh = ( char ) HB_GTSELF_GETCLEARCHAR( pGT ); if( szFrame ) { diff --git a/harbour/source/rtl/idle.c b/harbour/source/rtl/idle.c index 2beebab05d..4880190572 100644 --- a/harbour/source/rtl/idle.c +++ b/harbour/source/rtl/idle.c @@ -61,7 +61,6 @@ * */ - #include "hbapi.h" #include "hbapiitm.h" #include "hbset.h" @@ -142,9 +141,7 @@ void hb_idleReset( void ) PHB_IDLEDATA pIdleData = ( PHB_IDLEDATA ) hb_stackGetTSD( &s_idleData ); if( pIdleData->iIdleTask == pIdleData->iIdleMaxTask && !hb_setGetIdleRepeat() ) - { pIdleData->iIdleTask = 0; - } pIdleData->fCollectGarbage = TRUE; } @@ -192,14 +189,12 @@ HB_FUNC( HB_IDLEADD ) PHB_IDLEDATA pIdleData = ( PHB_IDLEDATA ) hb_stackGetTSD( &s_idleData ); ++pIdleData->iIdleMaxTask; - if( !pIdleData->pIdleTasks ) - { + + if( ! pIdleData->pIdleTasks ) pIdleData->pIdleTasks = ( HB_ITEM_PTR * ) hb_xgrab( sizeof( HB_ITEM_PTR ) ); - } else - { pIdleData->pIdleTasks = ( HB_ITEM_PTR * ) hb_xrealloc( pIdleData->pIdleTasks, sizeof( HB_ITEM_PTR ) * pIdleData->iIdleMaxTask ); - } + /* store a copy of passed codeblock */ pIdleData->pIdleTasks[ pIdleData->iIdleMaxTask - 1 ] = hb_itemNew( pBlock ); @@ -218,13 +213,12 @@ HB_FUNC( HB_IDLEDEL ) if( pID && pIdleData && pIdleData->pIdleTasks ) { - SHORT iTask; - HB_ITEM_PTR pItem; + int iTask = 0; - iTask = 0; while( iTask < pIdleData->iIdleMaxTask ) { - pItem = pIdleData->pIdleTasks[ iTask ]; + HB_ITEM_PTR pItem = pIdleData->pIdleTasks[ iTask ]; + if( pID == hb_codeblockId( pItem ) ) { hb_itemClear( hb_itemReturn( pItem ) ); /* return a codeblock */