From 9d3a557435333babb1fd81b0e01de31a7fcf94d6 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 17 Oct 2008 13:56:09 +0000 Subject: [PATCH] 2008-10-17 15:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/pp/hbpp.c * workaround for warning in some GCC versions which can lost user casting during function autoinline optimization. * harbour/source/rtl/console.c * harbour/source/rtl/gtapi.c * moved //INFO message from hb_gtInit() to hb_conInit() * harbour/source/rtl/hbgtcore.c * harbour/contrib/hbct/ctwin.c * minor cleanup --- harbour/ChangeLog | 13 ++++++++++++ harbour/contrib/hbct/ctwin.c | 38 +++++++++++++++++------------------ harbour/source/pp/hbpp.c | 10 ++++++++- harbour/source/rtl/console.c | 9 ++++++++- harbour/source/rtl/gtapi.c | 21 +++++++------------ harbour/source/rtl/hbgtcore.c | 2 +- 6 files changed, 57 insertions(+), 36 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7d0ab08397..4597f74102 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,19 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-10-17 15:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/pp/hbpp.c + * workaround for warning in some GCC versions which can lost + user casting during function autoinline optimization. + + * harbour/source/rtl/console.c + * harbour/source/rtl/gtapi.c + * moved //INFO message from hb_gtInit() to hb_conInit() + + * harbour/source/rtl/hbgtcore.c + * harbour/contrib/hbct/ctwin.c + * minor cleanup + 2008-10-17 12:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/debug/debugger.prg * changed __dbgInput() to return logical value and set edit value in diff --git a/harbour/contrib/hbct/ctwin.c b/harbour/contrib/hbct/ctwin.c index d97a1e1f19..28f16228b6 100644 --- a/harbour/contrib/hbct/ctwin.c +++ b/harbour/contrib/hbct/ctwin.c @@ -1688,8 +1688,8 @@ static int hb_ctw_gt_ReadKey( PHB_GT pGT, int iEventMask ) BOOL hb_ctwInit( void ) { - PHB_GT pGT = hb_gt_Base(); BOOL fResult = FALSE; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { fResult = hb_ctw_Init( pGT ); @@ -1700,8 +1700,8 @@ BOOL hb_ctwInit( void ) int hb_ctwSetShadowAttr( int iAttr ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_SetShadowAttr( pGT, iAttr ); @@ -1712,8 +1712,8 @@ int hb_ctwSetShadowAttr( int iAttr ) int hb_ctwSetMoveMode( int iMode ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_SetMoveMode( pGT, iMode ); @@ -1724,8 +1724,8 @@ int hb_ctwSetMoveMode( int iMode ) int hb_ctwSetMoveStep( int iVertical, int iHorizontal ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_SetMoveStep( pGT, iVertical, iHorizontal ); @@ -1736,8 +1736,8 @@ int hb_ctwSetMoveStep( int iVertical, int iHorizontal ) int hb_ctwSetWindowBoard( int iTop, int iLeft, int iBottom, int iRight ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_SetWindowBoard( pGT, iTop, iLeft, iBottom, iRight ); @@ -1749,8 +1749,8 @@ int hb_ctwSetWindowBoard( int iTop, int iLeft, int iBottom, int iRight ) int hb_ctwSetBorderMode( int iTop, int iLeft, int iBottom, int iRight ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_SetBorderMode( pGT, iTop, iLeft, iBottom, iRight ); @@ -1761,8 +1761,8 @@ int hb_ctwSetBorderMode( int iTop, int iLeft, int iBottom, int iRight ) int hb_ctwCreateWindow( int iTop, int iLeft, int iBottom, int iRight, BOOL fClear, int iColor ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_CreateWindow( pGT, iTop, iLeft, iBottom, iRight, fClear, iColor ); @@ -1774,8 +1774,8 @@ int hb_ctwCreateWindow( int iTop, int iLeft, int iBottom, int iRight, BOOL fCle int hb_ctwCloseAllWindows( void ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_CloseAllWindows( pGT ); @@ -1787,8 +1787,8 @@ int hb_ctwCloseAllWindows( void ) int hb_ctwCloseWindow( int iWindow ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_CloseWindow( pGT, iWindow ); @@ -1800,8 +1800,8 @@ int hb_ctwCloseWindow( int iWindow ) int hb_ctwCurrentWindow( void ) { - PHB_GT pGT = hb_gt_Base(); int iResult = 0; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_CurrentWindow( pGT ); @@ -1812,8 +1812,8 @@ int hb_ctwCurrentWindow( void ) int hb_ctwSelectWindow( int iWindow ) { - PHB_GT pGT = hb_gt_Base(); int iResult = 0; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_SelectWindow( pGT, iWindow ); @@ -1825,8 +1825,8 @@ int hb_ctwSelectWindow( int iWindow ) int hb_ctwMaxWindow( void ) { - PHB_GT pGT = hb_gt_Base(); int iResult = 0; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_MaxWindow( pGT ); @@ -1837,8 +1837,8 @@ int hb_ctwMaxWindow( void ) int hb_ctwChangeMargins( int iWindow, int iTop, int iLeft, int iBottom, int iRight ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_ChangeMargins( pGT, iWindow, iTop, iLeft, iBottom, iRight ); @@ -1849,8 +1849,8 @@ int hb_ctwChangeMargins( int iWindow, int iTop, int iLeft, int iBottom, int iRi int hb_ctwGetWindowCords( int iWindow, BOOL fCenter, int * piTop, int * piLeft, int * piBottom, int * piRight ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_GetWindowCords( pGT, iWindow, fCenter, piTop, piLeft, piBottom, piRight ); @@ -1861,8 +1861,8 @@ int hb_ctwGetWindowCords( int iWindow, BOOL fCenter, int * piTop, int * piLeft, int hb_ctwGetFormatCords( int iWindow, BOOL fRelative, int * piTop, int * piLeft, int * piBottom, int * piRight ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_GetFormatCords( pGT, iWindow, fRelative, piTop, piLeft, piBottom, piRight ); @@ -1873,8 +1873,8 @@ int hb_ctwGetFormatCords( int iWindow, BOOL fRelative, int * piTop, int * piLef int hb_ctwMoveWindow( int iWindow, int iRow, int iCol ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_MoveWindow( pGT, iWindow, iRow, iCol ); @@ -1885,8 +1885,8 @@ int hb_ctwMoveWindow( int iWindow, int iRow, int iCol ) int hb_ctwCenterWindow( int iWindow, BOOL fCenter ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_CenterWindow( pGT, iWindow, fCenter ); @@ -1897,8 +1897,8 @@ int hb_ctwCenterWindow( int iWindow, BOOL fCenter ) int hb_ctwAddWindowBox( int iWindow, BYTE * szBox, int iColor ) { - PHB_GT pGT = hb_gt_Base(); int iResult = -1; + PHB_GT pGT = hb_gt_Base(); if( pGT ) { iResult = hb_ctw_AddWindowBox( pGT, iWindow, szBox, iColor ); @@ -1913,7 +1913,7 @@ int hb_ctwLastKey( void ) /* keyread() in CT3 uses 64512 bytes length buffer * when it reach this limit and new key is added the * buffer size is decreased by 1024 to 63488 bytes - * before adding key. TODO: check id buffer is shifted + * before adding key. TODO: check if buffer is shifted */ if( !s_fInit ) { diff --git a/harbour/source/pp/hbpp.c b/harbour/source/pp/hbpp.c index 1b9f1e27bd..5d70f2a675 100644 --- a/harbour/source/pp/hbpp.c +++ b/harbour/source/pp/hbpp.c @@ -52,7 +52,6 @@ * */ -#include "ppcore.c" #include "hbset.h" #if defined(__MINGW32CE__) || defined(HB_WINCE) @@ -70,6 +69,15 @@ BYTE * hb_fsNameConv( BYTE * szFileName, BOOL * pfFree ) { if( pfFree ) * pfFree int hb_setGetDirSeparator( void ) { return HB_OS_PATH_DELIM_CHR; } int hb_verSvnID( void ) { return 0; } +/* workaround for warning in some GCC versions which can lost + * user casting during function autoinline optimization. + */ +#define hb_xgrab malloc +#define hb_xfree free +#define hb_xrealloc realloc + +#include "ppcore.c" + /* * functions to create .c files with rules defined in given PP context */ diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index bc828657bd..23a8d03ddf 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -156,7 +156,14 @@ void hb_conInit( void ) hb_fsSetDevMode( s_hFilenoStdout, FD_BINARY ); hb_fsSetDevMode( s_hFilenoStderr, FD_BINARY ); - hb_gtInit( s_hFilenoStdin, s_hFilenoStdout, s_hFilenoStderr ); + if( hb_gtInit( s_hFilenoStdin, s_hFilenoStdout, s_hFilenoStderr ) != SUCCESS ) + hb_errInternal( 9998, "Screen driver initialization failure", NULL, NULL ); + + if( hb_cmdargCheck( "INFO" ) ) + { + hb_conOutErr( hb_gtVersion( 1 ), 0 ); + hb_conOutErr( hb_conNewLine(), 0 ); + } } void hb_conRelease( void ) diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 97c0d9ed0b..bdf73227e6 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -95,21 +95,14 @@ HB_EXPORT ERRCODE hb_gtInit( HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, hb_gtStartupInit(); pGT = hb_gt_Base(); - if( pGT ) - { - HB_GTSELF_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ); - HB_GTSELF_SETCOLORSTR( pGT, hb_setGetColor() ); - HB_GTSELF_SETCURSORSTYLE( pGT, SC_NORMAL ); - HB_GTSELF_FLUSH( pGT ); - hb_gt_BaseFree( pGT ); - } + if( !pGT ) + return FAILURE; - if( hb_cmdargCheck( "INFO" ) ) - { - if( pGT ) - hb_conOutErr( HB_GTSELF_VERSION( pGT, 1 ), 0 ); - hb_conOutErr( hb_conNewLine(), 0 ); - } + HB_GTSELF_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ); + HB_GTSELF_SETCOLORSTR( pGT, hb_setGetColor() ); + HB_GTSELF_SETCURSORSTYLE( pGT, SC_NORMAL ); + HB_GTSELF_FLUSH( pGT ); + hb_gt_BaseFree( pGT ); return SUCCESS; } diff --git a/harbour/source/rtl/hbgtcore.c b/harbour/source/rtl/hbgtcore.c index 255b22bcfd..d5928501ed 100644 --- a/harbour/source/rtl/hbgtcore.c +++ b/harbour/source/rtl/hbgtcore.c @@ -3219,7 +3219,7 @@ HB_EXPORT void hb_gtStartupInit( void ) if( hb_gtLoad( hb_gt_szNameDefault, &s_gtCoreFunc ) ) return; - if( hb_dynsymFind( "HB_GT_NUL" ) ) /* GTNUL was explicitly requsted */ + if( hb_dynsymFind( "HB_GT_NUL" ) ) /* GTNUL was explicitly REQUESTed */ { if( hb_gtLoad( "NUL", &s_gtCoreFunc ) ) return;