From 386c27f01f399e88942d5fde0ce6c1104007e1e6 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 5 Jan 2007 15:01:11 +0000 Subject: [PATCH] 2007-01-05 16:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbexprb.c * make function call optimizations only when hb_compFunCallCheck() do not report errors * harbour/source/common/reserved.c + added VALTYPE to list of reserved words and shortcuts (Clipper compatible) * harbour/source/compiler/hbfunchk.c * checking for number of parameters in FILE() function call is Harbour extension - do not enable it when HB_C52_STRICT macro is set * harbour/source/rtl/filehb.c * formatting --- harbour/ChangeLog | 16 ++++++++++ harbour/include/hbexprb.c | 49 +++++++++++++++--------------- harbour/source/common/reserved.c | 1 + harbour/source/compiler/hbfunchk.c | 2 ++ harbour/source/rtl/filehb.c | 4 ++- 5 files changed, 47 insertions(+), 25 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5163ced005..60c323719f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,22 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-01-05 16:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbexprb.c + * make function call optimizations only when hb_compFunCallCheck() + do not report errors + + * harbour/source/common/reserved.c + + added VALTYPE to list of reserved words and shortcuts (Clipper + compatible) + + * harbour/source/compiler/hbfunchk.c + * checking for number of parameters in FILE() function call is Harbour + extension - do not enable it when HB_C52_STRICT macro is set + + * harbour/source/rtl/filehb.c + * formatting + 2007-01-05 08:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbcompdf.h + added comment diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index 7b1589bd68..a1fe61914c 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -1541,32 +1541,33 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) USHORT usCount = ( USHORT ) hb_compExprParamListLen( pParms ); #ifndef HB_MACRO_SUPPORT - hb_compFunCallCheck( HB_COMP_PARAM, pName->value.asSymbol, usCount ); + if( hb_compFunCallCheck( HB_COMP_PARAM, pName->value.asSymbol, usCount ) ) #endif - - if( ( strcmp( "AT", pName->value.asSymbol ) == 0 ) && usCount == 2 ) { - hb_compExprReduceAT( pSelf, HB_COMP_PARAM ); - } - else if( ( strcmp( "CHR", pName->value.asSymbol ) == 0 ) && usCount ) - { - hb_compExprReduceCHR( pSelf, HB_COMP_PARAM ); - } - else if( ( strcmp( "LEN", pName->value.asSymbol ) == 0 ) && usCount ) - { - if( HB_SUPPORT_HARBOUR ) - hb_compExprReduceLEN( pSelf, HB_COMP_PARAM ); - } - else if( ( strcmp( "ASC", pName->value.asSymbol ) == 0 ) && usCount ) - { - if( HB_SUPPORT_HARBOUR ) - hb_compExprReduceASC( pSelf, HB_COMP_PARAM ); - } - else if( ( ( strcmp( "STOD", pName->value.asSymbol ) == 0 ) || - ( strcmp( "HB_STOD", pName->value.asSymbol ) == 0 ) ) && usCount < 2 ) - { - if( HB_SUPPORT_HARBOUR ) - hb_compExprReduceSTOD( pSelf, usCount, HB_COMP_PARAM ); + if( ( strcmp( "AT", pName->value.asSymbol ) == 0 ) && usCount == 2 ) + { + hb_compExprReduceAT( pSelf, HB_COMP_PARAM ); + } + else if( ( strcmp( "CHR", pName->value.asSymbol ) == 0 ) && usCount ) + { + hb_compExprReduceCHR( pSelf, HB_COMP_PARAM ); + } + else if( ( strcmp( "LEN", pName->value.asSymbol ) == 0 ) && usCount ) + { + if( HB_SUPPORT_HARBOUR ) + hb_compExprReduceLEN( pSelf, HB_COMP_PARAM ); + } + else if( ( strcmp( "ASC", pName->value.asSymbol ) == 0 ) && usCount ) + { + if( HB_SUPPORT_HARBOUR ) + hb_compExprReduceASC( pSelf, HB_COMP_PARAM ); + } + else if( ( ( strcmp( "STOD", pName->value.asSymbol ) == 0 ) || + ( strcmp( "HB_STOD", pName->value.asSymbol ) == 0 ) ) && usCount < 2 ) + { + if( HB_SUPPORT_HARBOUR ) + hb_compExprReduceSTOD( pSelf, usCount, HB_COMP_PARAM ); + } } } break; diff --git a/harbour/source/common/reserved.c b/harbour/source/common/reserved.c index 7b9a788b0f..fa467b6af4 100644 --- a/harbour/source/common/reserved.c +++ b/harbour/source/common/reserved.c @@ -119,6 +119,7 @@ static const char * s_szReservedFun[] = { "TYPE" , "UPPER" , "VAL" , + "VALTYPE" , "WORD" , "YEAR" }; diff --git a/harbour/source/compiler/hbfunchk.c b/harbour/source/compiler/hbfunchk.c index b021e68054..39193644c5 100644 --- a/harbour/source/compiler/hbfunchk.c +++ b/harbour/source/compiler/hbfunchk.c @@ -72,7 +72,9 @@ static HB_FUNCINFO hb_StdFunc[] = { "EXP" , 1, 1 }, { "FCOUNT" , 0, 0 }, { "FIELDNAME" , 1, 1 }, +#if !defined( HB_C52_STRICT ) { "FILE" , 1, 1 }, +#endif { "FLOCK" , 0, 0 }, { "FOUND" , 0, 0 }, { "INKEY" , 0, 2 }, diff --git a/harbour/source/rtl/filehb.c b/harbour/source/rtl/filehb.c index 40de295121..607994b4f0 100644 --- a/harbour/source/rtl/filehb.c +++ b/harbour/source/rtl/filehb.c @@ -61,5 +61,7 @@ HB_FUNC( FILE ) { - hb_retl( ISCHAR( 1 ) ? hb_spFile( ( BYTE * ) hb_parc( 1 ),NULL ) : FALSE ); + BYTE * szFile = ( BYTE * ) hb_parc( 1 ); + + hb_retl( szFile ? hb_spFile( szFile, NULL ) : FALSE ); }