2008-06-11 04:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbexprop.h
  * harbour/include/hbexprb.c
  * harbour/source/common/expropt2.c
    * added optimization for DTOS( <date_constant> ), f.e.:
      static s := DTOS( 0d20080611 )
This commit is contained in:
Przemyslaw Czerpak
2008-06-11 02:10:29 +00:00
parent 3b543d3039
commit 8d0a5f3542
4 changed files with 34 additions and 0 deletions

View File

@@ -8,6 +8,13 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-06-11 04:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/common/expropt2.c
* added optimization for DTOS( <date_constant> ), f.e.:
static s := DTOS( 0d20080611 )
2008-06-11 01:17 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/common/hbwince.c
! fixed typo in GetDriveTypeA()

View File

@@ -1638,6 +1638,10 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
if( HB_SUPPORT_HARBOUR )
hb_compExprReduceSTOD( pSelf, usCount, HB_COMP_PARAM );
}
else if( strcmp( "DTOS", pName->value.asSymbol ) == 0 && usCount == 1 )
{
hb_compExprReduceDTOS( pSelf, HB_COMP_PARAM );
}
else if( strcmp( "CTOD", pName->value.asSymbol ) == 0 && usCount )
{
if( HB_SUPPORT_HARBOUR )

View File

@@ -199,6 +199,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_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 );
extern BOOL hb_compExprReduceUPPER( HB_EXPR_PTR, HB_COMP_DECL );
extern BOOL hb_compExprReduceBitFunc( HB_EXPR_PTR, HB_LONG, BOOL, HB_COMP_DECL );

View File

@@ -1671,6 +1671,28 @@ BOOL hb_compExprReduceINT( HB_EXPR_PTR pSelf, HB_COMP_DECL )
return FALSE;
}
BOOL hb_compExprReduceDTOS( 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_DATE )
{
char szBuffer[ 9 ];
char * szDate = ( char * ) memcpy( hb_xgrab( 9 ),
hb_dateDecStr( szBuffer, pArg->value.asNum.val.l ), 9 );
HB_EXPR_PTR pExpr = hb_compExprNewString( szDate, 8, TRUE, 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 )