2009-10-19 11:53 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbexprb.c
! always optimized ASC() and LEN() functions (was disabled by -kc switch).
These optimizations are not Harbour extensions - Clipper also optimize
above functions
* harbour/doc/cmpopt.txt
* updated optimization description
* harbour/doc/pp.txt
+ added information about new lexer
This commit is contained in:
@@ -17,6 +17,18 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-10-19 11:53 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbexprb.c
|
||||
! always optimized ASC() and LEN() functions (was disabled by -kc switch).
|
||||
These optimizations are not Harbour extensions - Clipper also optimize
|
||||
above functions
|
||||
|
||||
* harbour/doc/cmpopt.txt
|
||||
* updated optimization description
|
||||
|
||||
* harbour/doc/pp.txt
|
||||
+ added information about new lexer
|
||||
|
||||
2009-10-19 10:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/src/rtl/cdpapi.c
|
||||
* harbour/include/hbapicdp.h
|
||||
|
||||
@@ -15,23 +15,24 @@ optimized at compile time:
|
||||
|
||||
AT( <cConst1>, <cConst2> ) // Clipper wrongly calculates
|
||||
// AT( "", <cConst> ) as 1
|
||||
ASC( <cConst> [ , ... ] )
|
||||
CHR( <nConst> )
|
||||
LEN( <cConst> | <aConst> | <hConst> ) // <hConst> is Harbour extension
|
||||
UPPER( <cConst> ) // <cConst> cannot contain characters different then
|
||||
[0-9A-Za-z ]
|
||||
|
||||
- Harbour extension:
|
||||
|
||||
INT( <nConst> )
|
||||
ASC( <cConst> [ , ... ] )
|
||||
MIN( <xConst1>, <xConst2> ) // <xConstN> is N, D or L value
|
||||
MAX( <xConst1>, <xConst2> ) // <xConstN> is N, D or L value
|
||||
EMPTY( <aConst> | <hConst> | <cConst> | <bConst> |
|
||||
<nConst> | <dConst>| <lConst> | NIL )
|
||||
LEN( <cConst> | <aConst> | <hConst> )
|
||||
CTOD( <cConst> [ , ... } )
|
||||
CTOD( "" [ , ... ] )
|
||||
DTOS( <dConst> ] )
|
||||
STOD( [ <cConst> ] )
|
||||
HB_STOD( [ <cConst> ] )
|
||||
HB_STOT( [ <cConst> ] )
|
||||
HB_BITNOT( <nConst> [, ... ] )
|
||||
HB_BITAND( <nConst1>, <nConst2> [, <nConstN> ] )
|
||||
HB_BITOR( <nConst1>, <nConst2> [, <nConstN> ] )
|
||||
@@ -45,6 +46,8 @@ optimized at compile time:
|
||||
|
||||
HB_I18N_GETTEXT_NOOP( <cConst1> [ , <cConst2> ] )
|
||||
HB_I18N_NGETTEXT_NOOP( <cConst1> | <acConst1> [ , <cConst2> ] )
|
||||
HB_I18N_GETTEXT_NOOP_*( <cConst1> [ , <cConst2> ] )
|
||||
HB_I18N_NGETTEXT_NOOP_*( <cConst1> | <acConst1> [ , <cConst2> ] )
|
||||
HB_MUTEXCREATE()
|
||||
|
||||
|
||||
@@ -171,7 +174,7 @@ does not optimize <exp> in expressions like:
|
||||
Unlike Clipper Harbour tries to optimize all expressions.
|
||||
|
||||
If some code needs strict Clipper behavior then it can be forced by using
|
||||
-kc Harbour compiler switch. It disabled Harbour extensions and enables
|
||||
-kc Harbour compiler switch. It disables Harbour extensions and enables
|
||||
replicating some Clipper bugs like optimizing "" $ <cConst> to .T. at
|
||||
compile time (at runtime and in macrocompiler it's always .F. in Clipper
|
||||
and Harbour).
|
||||
|
||||
@@ -673,6 +673,11 @@ I had to break Clipper compatibility to keep FLEX working. Just simply
|
||||
I cannot generate preprocessed line in exactly the same form as Clipper
|
||||
does because FLEX or SIMPLEX will not be able to decode it.
|
||||
|
||||
Update:
|
||||
New Harbour lexer is simple translator between PP tokens and Harbour
|
||||
grammar terminal symbols so it's not necessary to convert preprocessed
|
||||
code to strings to pass them to FLEX or SIMPLEX. It works faster and it's
|
||||
fully compatible Clipper behavior what fixes above problem.
|
||||
|
||||
best regards,
|
||||
Przemek
|
||||
|
||||
@@ -1726,6 +1726,11 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
|
||||
if( usCount == 2 )
|
||||
hb_compExprReduceAT( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "ASC", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount )
|
||||
hb_compExprReduceASC( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "CHR", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount )
|
||||
@@ -1733,24 +1738,34 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
|
||||
}
|
||||
else if( strcmp( "LEN", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount && HB_SUPPORT_HARBOUR )
|
||||
if( usCount )
|
||||
hb_compExprReduceLEN( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "UPPER", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount )
|
||||
hb_compExprReduceUPPER( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "EMPTY", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount && HB_SUPPORT_HARBOUR )
|
||||
hb_compExprReduceEMPTY( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "ASC", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount && HB_SUPPORT_HARBOUR )
|
||||
hb_compExprReduceASC( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "INT", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount == 1 && HB_SUPPORT_HARBOUR )
|
||||
hb_compExprReduceINT( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "MIN", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount == 2 && HB_SUPPORT_HARBOUR )
|
||||
hb_compExprReduceMIN( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "MAX", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount == 2 && HB_SUPPORT_HARBOUR )
|
||||
hb_compExprReduceMAX( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "STOD", pName->value.asSymbol ) == 0 ||
|
||||
strcmp( "HB_STOD", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
@@ -1771,21 +1786,6 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
|
||||
if( usCount && HB_SUPPORT_HARBOUR )
|
||||
hb_compExprReduceCTOD( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "MIN", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount == 2 && HB_SUPPORT_HARBOUR )
|
||||
hb_compExprReduceMIN( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "MAX", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount == 2 && HB_SUPPORT_HARBOUR )
|
||||
hb_compExprReduceMAX( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strcmp( "UPPER", pName->value.asSymbol ) == 0 )
|
||||
{
|
||||
if( usCount )
|
||||
hb_compExprReduceUPPER( pSelf, HB_COMP_PARAM );
|
||||
}
|
||||
else if( strncmp( "HB_BIT", pName->value.asSymbol, 6 ) == 0 &&
|
||||
usCount && pParms->value.asList.pExprList->ExprType == HB_ET_NUMERIC )
|
||||
{
|
||||
@@ -1902,16 +1902,14 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
|
||||
if( strncmp( "_STRICT", &pName->value.asSymbol[ ulPos ], 7 ) == 0 )
|
||||
{
|
||||
ulPos += 7;
|
||||
if( !pName->value.asSymbol[ ulPos ] || pName->value.asSymbol[ ulPos ] == '_' )
|
||||
fI18nFunc = fStrict = TRUE;
|
||||
fStrict = TRUE;
|
||||
}
|
||||
else if( strncmp( "_NOOP", &pName->value.asSymbol[ ulPos ], 5 ) == 0 )
|
||||
{
|
||||
ulPos += 5;
|
||||
if( !pName->value.asSymbol[ ulPos ] || pName->value.asSymbol[ ulPos ] == '_' )
|
||||
fI18nFunc = fNoop = TRUE;
|
||||
fNoop = TRUE;
|
||||
}
|
||||
else if( !pName->value.asSymbol[ ulPos ] || pName->value.asSymbol[ ulPos ] == '_' )
|
||||
if( !pName->value.asSymbol[ ulPos ] || pName->value.asSymbol[ ulPos ] == '_' )
|
||||
fI18nFunc = TRUE;
|
||||
}
|
||||
if( fI18nFunc )
|
||||
|
||||
Reference in New Issue
Block a user