2007-06-03 23:03 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)

* harbour/include/hbexprop.h
  * harbour/include/hbexprb.c
  * harbour/source/common/expropt2.c
     * added UPPER("") optimisation. The side effect of this modification
       is that Harbour becomes Clipper bug compatible in calculation of
       AT(UPPER(""), "test"). Though this optimisation does not introduce
       any buggy behaviour itself.
This commit is contained in:
Mindaugas Kavaliauskas
2007-06-03 19:59:39 +00:00
parent e73934158e
commit caec86d5d5
4 changed files with 38 additions and 0 deletions

View File

@@ -8,6 +8,15 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-06-03 23:03 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/common/expropt2.c
* added UPPER("") optimisation. The side effect of this modification
is that Harbour becomes Clipper bug compatible in calculation of
AT(UPPER(""), "test"). Though this optimisation does not introduce
any buggy behaviour itself.
2007-06-02 12:30 UTC+0200 Enrico Maria Giordano (e.m.giordano@emagsoftware.it)
* harbour/contrib/hbzlib
* replaced with the one borrowed from xharbour, source modifications by Przemek

View File

@@ -1581,6 +1581,10 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
if( HB_SUPPORT_HARBOUR )
hb_compExprReduceSTOD( pSelf, usCount, HB_COMP_PARAM );
}
else if( ( strcmp( "UPPER", pName->value.asSymbol ) == 0 ) && usCount )
{
hb_compExprReduceUPPER( pSelf, HB_COMP_PARAM );
}
}
}
break;

View File

@@ -195,6 +195,7 @@ 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_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_COMP_DECL );
extern BOOL hb_compExprReduceUPPER( HB_EXPR_PTR, HB_COMP_DECL );
HB_EXTERN_END

View File

@@ -1436,3 +1436,27 @@ BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_COMP_DECL )
return FALSE;
}
BOOL hb_compExprReduceUPPER( 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_STRING && pArg->ulLength == 0 )
{
HB_EXPR_PTR pExpr = HB_COMP_EXPR_NEW( HB_ET_STRING );
pExpr->ValType = HB_EV_STRING;
pExpr->value.asString.string = "";
pExpr->value.asString.dealloc = FALSE;
pExpr->ulLength = 0;
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;
}