2009-05-11 14:43 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 optimization for hb_stot() function
This commit is contained in:
@@ -17,6 +17,12 @@
|
||||
past entries belonging to these authors: Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-05-11 14:43 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 optimization for hb_stot() function
|
||||
|
||||
2009-05-11 14:00 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* INSTALL
|
||||
+ Added TROUBLESHOOTING section. Contains only obvious,
|
||||
|
||||
@@ -1708,6 +1708,10 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
|
||||
if( usCount < 2 && HB_SUPPORT_HARBOUR )
|
||||
hb_compExprReduceSTOD( pSelf, usCount, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "HB_STOT", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
hb_compExprReduceSTOT( pSelf, usCount, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "DTOS", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount == 1 )
|
||||
|
||||
@@ -201,6 +201,7 @@ 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_compExprReduceEMPTY( HB_EXPR_PTR, HB_COMP_DECL );
|
||||
extern BOOL hb_compExprReduceSTOT( HB_EXPR_PTR, USHORT usCount, HB_COMP_DECL );
|
||||
extern BOOL hb_compExprReduceSTOD( HB_EXPR_PTR, USHORT usCount, HB_COMP_DECL );
|
||||
extern BOOL hb_compExprReduceDTOS( HB_EXPR_PTR, HB_COMP_DECL );
|
||||
extern BOOL hb_compExprReduceCTOD( HB_EXPR_PTR, HB_COMP_DECL );
|
||||
|
||||
@@ -2152,6 +2152,68 @@ BOOL hb_compExprReduceINT( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL hb_compExprReduceSTOT( HB_EXPR_PTR pSelf, USHORT usCount, HB_COMP_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
|
||||
HB_EXPR_PTR pArg = pParms ? pParms->value.asList.pExprList : NULL;
|
||||
HB_EXPR_PTR pExpr = NULL;
|
||||
|
||||
if( usCount == 0 )
|
||||
{
|
||||
pExpr = hb_compExprNewTimeStamp( 0, 0, HB_COMP_PARAM );
|
||||
}
|
||||
else if( pArg && pArg->ExprType == HB_ET_STRING )
|
||||
{
|
||||
long lDate, lTime;
|
||||
|
||||
hb_timeStampStrRawGet( pArg->value.asString.string, &lDate, &lTime );
|
||||
pExpr = hb_compExprNewTimeStamp( lDate, lTime, HB_COMP_PARAM );
|
||||
}
|
||||
|
||||
if( pExpr )
|
||||
{
|
||||
if( pSelf->value.asFunCall.pParms )
|
||||
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 )
|
||||
{
|
||||
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
|
||||
HB_EXPR_PTR pArg = pParms ? pParms->value.asList.pExprList : NULL;
|
||||
HB_EXPR_PTR pExpr = NULL;
|
||||
|
||||
if( usCount == 0 )
|
||||
{
|
||||
pExpr = hb_compExprNewDate( 0, HB_COMP_PARAM );
|
||||
}
|
||||
else if( pArg && pArg->ExprType == HB_ET_STRING &&
|
||||
( pArg->ulLength >= 7 || pArg->ulLength == 0 ) )
|
||||
{
|
||||
pExpr = hb_compExprNewDate( pArg->ulLength == 0 ? 0 :
|
||||
hb_dateEncStr( pArg->value.asString.string ),
|
||||
HB_COMP_PARAM );
|
||||
}
|
||||
|
||||
if( pExpr )
|
||||
{
|
||||
if( pSelf->value.asFunCall.pParms )
|
||||
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_compExprReduceDTOS( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
|
||||
@@ -2176,40 +2238,6 @@ BOOL hb_compExprReduceDTOS( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_COMP_DECL )
|
||||
{
|
||||
if( usCount == 1 )
|
||||
{
|
||||
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
|
||||
HB_EXPR_PTR pArg = pParms->value.asList.pExprList;
|
||||
|
||||
if( pArg->ExprType == HB_ET_STRING && ( pArg->ulLength == 8 || pArg->ulLength == 0 ) )
|
||||
{
|
||||
HB_EXPR_PTR pExpr = hb_compExprNewDate( pArg->ulLength == 0 ? 0 :
|
||||
hb_dateEncStr( pArg->value.asString.string ),
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_EXPR_PTR pExpr = hb_compExprNewDate( 0, HB_COMP_PARAM );
|
||||
|
||||
HB_COMP_EXPR_FREE( pSelf->value.asFunCall.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_compExprReduceCTOD( HB_EXPR_PTR pSelf, HB_COMP_DECL )
|
||||
{
|
||||
HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms;
|
||||
|
||||
Reference in New Issue
Block a user