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( <num> ) optimization
* harbour/source/compiler/hbusage.c
* updated -k? description to show "(default)" for really set flags
This commit is contained in:
@@ -8,6 +8,15 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
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( <num> ) 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.
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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)" );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user