diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e91c200d2c..3e7a4737fd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,22 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-03-12 14:30 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbexpra.c + * emulate xHarbour HB_ENUMINDEX() inside FOR EACH loop when + HB_COMPAT_XHB macro is set + It's only for compatibility - I strongly suggest to use + :__enumIndex() + which is more flexible and allow to chose the enumerator + variable not only the one from last loop + + * harbour/include/hbexprb.c + * added comment removed from hbexpra.c + + * harbour/source/compiler/hbmain.c + ! fixed GPF which can appear when -b option is used in line numbering + inside codeblocks + 2007-03-11 11:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/main/Makefile * Changed order of linked libraries for linkers with linear library diff --git a/harbour/include/hbexpra.c b/harbour/include/hbexpra.c index 8bd0f2d578..8bc13afcde 100644 --- a/harbour/include/hbexpra.c +++ b/harbour/include/hbexpra.c @@ -135,7 +135,29 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM iCount = ( int ) hb_compExprParamListLen( pParms ); /* TODO: EMPTY() (not done by Clipper) */ - if( iCount && strcmp( "EVAL", pName->value.asSymbol ) == 0 ) + if( iCount == 0 ) + { +#if !defined( HB_MACRO_SUPPORT ) && defined( HB_COMPAT_XHB ) + if( strcmp( "HB_ENUMINDEX", pName->value.asSymbol ) == 0 ) + { + HB_ENUMERATOR_PTR pEnumVar; + pEnumVar = HB_COMP_PARAM->functions.pLast->pEnum; + if( pEnumVar ) + { + while( pEnumVar->pNext ) + pEnumVar = pEnumVar->pNext; + + HB_COMP_EXPR_DELETE( pParms ); + HB_COMP_EXPR_DELETE( pName ); + return hb_compExprNewMethodCall( hb_compExprNewSend( + hb_compExprNewVar( pEnumVar->szName, HB_COMP_PARAM ), + "__ENUMINDEX", NULL, HB_COMP_PARAM ), NULL ); + } + } +#endif + } + /* TODO: EMPTY() (not done by Clipper) */ + else if( strcmp( "EVAL", pName->value.asSymbol ) == 0 ) { HB_EXPR_PTR pEval; /* Optimize Eval( bBlock, [ArgList] ) to: bBlock:Eval( [ArgList] ) */ @@ -153,7 +175,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM HB_COMP_EXPR_DELETE( pName ); return pEval; } - else if( iCount && strcmp( "_GET_", pName->value.asSymbol ) == 0 ) + else if( strcmp( "_GET_", pName->value.asSymbol ) == 0 ) { /* Reserved Clipper function used to handle GET variables */ diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index f6bf8eb3f1..2d718bf81f 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -1434,6 +1434,7 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) if( hb_compFunCallCheck( HB_COMP_PARAM, pName->value.asSymbol, usCount ) ) #endif { + /* TODO: EMPTY() (not done by Clipper) */ if( ( strcmp( "AT", pName->value.asSymbol ) == 0 ) && usCount == 2 ) { hb_compExprReduceAT( pSelf, HB_COMP_PARAM ); diff --git a/harbour/source/compiler/hbmain.c b/harbour/source/compiler/hbmain.c index c7283c44a2..14ebe287fa 100644 --- a/harbour/source/compiler/hbmain.c +++ b/harbour/source/compiler/hbmain.c @@ -2362,7 +2362,8 @@ void hb_compLinePush( HB_COMP_DECL ) /* generates the pcode with the currently c if( HB_COMP_PARAM->currLine != HB_COMP_PARAM->lastLine ) { - if( HB_COMP_PARAM->functions.pLast->pCode[ HB_COMP_PARAM->lastLinePos ] == HB_P_LINE && + if( HB_COMP_PARAM->lastLinePos < HB_COMP_PARAM->functions.pLast->lPCodePos && + HB_COMP_PARAM->functions.pLast->pCode[ HB_COMP_PARAM->lastLinePos ] == HB_P_LINE && HB_COMP_PARAM->functions.pLast->lPCodePos - HB_COMP_PARAM->lastLinePos == 3 ) { HB_COMP_PARAM->functions.pLast->pCode[ HB_COMP_PARAM->lastLinePos + 1 ] = HB_LOBYTE( HB_COMP_PARAM->currLine ); @@ -4048,6 +4049,7 @@ void hb_compCodeBlockStart( HB_COMP_DECL, BOOL bLateEval ) pBlock->bLateEval = bLateEval; HB_COMP_PARAM->functions.pLast = pBlock; + HB_COMP_PARAM->lastLinePos = 0; } void hb_compCodeBlockEnd( HB_COMP_DECL )