diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c8945a7450..9f8c7d035e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,15 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-06-02 19:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbexprop.h + * harbour/include/hbexprb.c + * harbour/source/common/expropt2.c + + added compile time INT( ) optimization + + * harbour/source/compiler/hbusage.c + * updated -k? description to show "(default)" for really set flags + 2008-06-02 18:59 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * contrib/xhb/hbcompat.ch ! Minor fix in hb to xhb branch. diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index f682670e82..9cc2c36a30 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -1633,6 +1633,11 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) if( HB_SUPPORT_HARBOUR ) hb_compExprReduceASC( pSelf, HB_COMP_PARAM ); } + else if( strcmp( "INT", pName->value.asSymbol ) == 0 && usCount == 1 ) + { + if( HB_SUPPORT_HARBOUR ) + hb_compExprReduceINT( pSelf, HB_COMP_PARAM ); + } else if( ( strcmp( "STOD", pName->value.asSymbol ) == 0 || strcmp( "HB_STOD", pName->value.asSymbol ) == 0 ) && usCount < 2 ) { diff --git a/harbour/include/hbexprop.h b/harbour/include/hbexprop.h index 954b19ffad..aa495fb45a 100644 --- a/harbour/include/hbexprop.h +++ b/harbour/include/hbexprop.h @@ -197,6 +197,7 @@ extern BOOL hb_compExprReduceAT( HB_EXPR_PTR, HB_COMP_DECL ); extern BOOL hb_compExprReduceCHR( HB_EXPR_PTR, HB_COMP_DECL ); extern BOOL hb_compExprReduceLEN( HB_EXPR_PTR, HB_COMP_DECL ); extern BOOL hb_compExprReduceASC( HB_EXPR_PTR, HB_COMP_DECL ); +extern BOOL hb_compExprReduceINT( HB_EXPR_PTR, HB_COMP_DECL ); extern BOOL hb_compExprReduceSTOD( HB_EXPR_PTR, USHORT usCount, HB_COMP_DECL ); extern BOOL hb_compExprReduceCTOD( HB_EXPR_PTR, HB_COMP_DECL ); extern BOOL hb_compExprReduceUPPER( HB_EXPR_PTR, HB_COMP_DECL ); diff --git a/harbour/source/common/expropt2.c b/harbour/source/common/expropt2.c index b0c19817cb..31bdf40c4a 100644 --- a/harbour/source/common/expropt2.c +++ b/harbour/source/common/expropt2.c @@ -1648,6 +1648,36 @@ BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_COMP_DECL ) return FALSE; } +BOOL hb_compExprReduceINT( HB_EXPR_PTR pSelf, HB_COMP_DECL ) +{ + HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; + HB_EXPR_PTR pArg = pParms->value.asList.pExprList; + + if( pArg->ExprType == HB_ET_NUMERIC ) + { + HB_EXPR_PTR pExpr; + + if( pArg->value.asNum.NumType == HB_ET_LONG ) + pExpr = hb_compExprNewLong( pArg->value.asNum.val.l, HB_COMP_PARAM ); + else + { + HB_MAXDBL dVal = ( HB_MAXDBL ) pArg->value.asNum.val.d; + if( HB_DBL_LIM_LONG( dVal ) ) + pExpr = hb_compExprNewLong( ( HB_LONG ) pArg->value.asNum.val.d, HB_COMP_PARAM ); + else + pExpr = hb_compExprNewDouble( pArg->value.asNum.val.d, + pArg->value.asNum.bWidth, 0, + HB_COMP_PARAM ); + } + HB_COMP_EXPR_FREE( pParms ); + HB_COMP_EXPR_FREE( pSelf->value.asFunCall.pFunName ); + memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); + HB_COMP_EXPR_CLEAR( pExpr ); + return TRUE; + } + return FALSE; +} + BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_COMP_DECL ) { if( usCount == 1 ) diff --git a/harbour/source/compiler/hbusage.c b/harbour/source/compiler/hbusage.c index e4703b52c5..b9a87b3609 100644 --- a/harbour/source/compiler/hbusage.c +++ b/harbour/source/compiler/hbusage.c @@ -128,7 +128,7 @@ void hb_compPrintModes( HB_COMP_DECL ) static const char * szOptions [] = { "\nOptions: c clear all flags (strict Clipper mode)", - "\n h Harbour mode (default)", + "\n h Harbour mode", "\n i enable support for HB_INLINE", "\n r runtime settings enabled", "\n s allow indexed assignment on all types", @@ -138,13 +138,30 @@ void hb_compPrintModes( HB_COMP_DECL ) "\n ? this info", "\n" }; + static const int flags[] = + { + 0, + HB_COMPFLAG_HARBOUR, + HB_COMPFLAG_HB_INLINE, + HB_COMPFLAG_RT_MACRO, + HB_COMPFLAG_ARRSTR, + HB_COMPFLAG_XBASE, + ~HB_COMPFLAG_OPTJUMP, + ~HB_COMPFLAG_MACROTEXT, + }; int iLine; hb_compOutStd( HB_COMP_PARAM, "\nCompatibility flags (lowercase/uppercase significant): -k[options]\n" ); for( iLine = 0; iLine < ( int ) ( sizeof( szOptions ) / sizeof( char * ) ); iLine++ ) + { hb_compOutStd( HB_COMP_PARAM, szOptions[ iLine ] ); + if( iLine < ( int ) ( sizeof( flags ) / sizeof( int ) ) && + ( flags[ iLine ] < 0 ? ! HB_COMP_ISSUPPORTED( ~flags[ iLine ] ) : + HB_COMP_ISSUPPORTED( flags[ iLine ] ) ) ) + hb_compOutStd( HB_COMP_PARAM, " (default)" ); + } } /*