From 4a97830f2bc1a988c93fa4d9c2c14b6d8e27228e Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Thu, 6 Nov 2003 10:42:58 +0000 Subject: [PATCH] Changelog 2003-11-06 11:40 UTC+0100 Ryszard Glab --- harbour/ChangeLog | 44 ++++++++++ harbour/include/hbexpra.c | 51 +---------- harbour/include/hbexprb.c | 80 +++++++++-------- harbour/include/hbexprc.c | 8 +- harbour/include/hbexprop.h | 8 +- harbour/source/common/expropt1.c | 2 +- harbour/source/common/expropt2.c | 135 ++++++++++++++++++++++++++++- harbour/source/compiler/expropta.c | 2 +- harbour/source/compiler/exproptb.c | 2 +- harbour/source/compiler/exproptc.c | 2 +- harbour/source/compiler/harbour.c | 1 - harbour/source/compiler/harbour.l | 15 ++-- harbour/source/macro/macroa.c | 2 +- harbour/source/macro/macrob.c | 2 +- harbour/source/macro/macroc.c | 2 +- harbour/source/vm/cmdarg.c | 2 +- harbour/source/vm/hvm.c | 2 +- 17 files changed, 252 insertions(+), 108 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fa38db587c..e25eae4a37 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,50 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2003-11-06 11:40 UTC+0100 Ryszard Glab + * source/compiler/harbour.l + * enabled support for break[] (if not full Clipper + compatibility mode was requested) + + * include/hbexpra.c + * include/hbexprb.c + * include/hbexprc.c + * include/hbexprop.h + * source/common/expropt2.c + * source/compiler/expropta.c + * source/compiler/exproptb.c + * source/compiler/exproptc.c + * source/macro/macroa.c + * source/macro/macrob.c + * source/macro/macroc.c + * fixed optimalization of literal strings that contain macro + operator - strings are not joined if the left argument of + '+' operator contains '&' + for example: + CHR(38)+'text' -> will no longer look for 'text' variable + '&var'+'iable' -> will look for 'var' variable instead of + 'variable' + + + added optimalization of ASC function + for example: + ASC('&') will be replaced with 38 + + + added optimalization of LEN function + for example: + LEN("123") will be replaced with 3 + LEN( {1,2} ) will be replaced with 2 + Optimalization od ASC, LEN is disabled if strict Clipper + mode is requested (-kc) + + * source/compiler/harbour.c + * support for strings as array of bytes is disabled by default now + (use -ks to enable it) + + * source/vm/cmdarg.c + * source/vm/hvm.c + * support for strings as array of bytes is disabled by default now + (use //FLAGS:s to enable it) + 2003-11-06 11:00 UTC+0300 Alexander Kresin * source/vm/hvm.c * RDD initialization added ( made by Przemyslaw Czerpak ) - I forgot to diff --git a/harbour/include/hbexpra.c b/harbour/include/hbexpra.c index 63b3c5e5f7..af35ddb976 100644 --- a/harbour/include/hbexpra.c +++ b/harbour/include/hbexpra.c @@ -279,56 +279,9 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) hb_compFunCallCheck( pName->value.asSymbol, iCount ); #endif - /* TODO: AT() (also done by Clipper, already mentioned) - LEN() (also done by Clipper) - ASC() (not done by Clipper) - EMPTY() (not done by Clipper) */ + /* TODO: EMPTY() (not done by Clipper) */ - if( ( strcmp( "CHR", pName->value.asSymbol ) == 0 ) && iCount ) - { - /* try to change it into a string */ - HB_EXPR_PTR pArg = pParms->value.asList.pExprList; - - if( pArg->ExprType == HB_ET_NUMERIC ) - { - /* NOTE: CA-Cl*pper's compiler optimizer will be wrong for those - CHR() cases where the passed parameter is a constant which - can be divided by 256 but it's not zero, in this case it - will return an empty string instead of a Chr(0). [vszakats] */ - - pExpr = hb_compExprNew( HB_ET_STRING ); - pExpr->ValType = HB_EV_STRING; - if( pArg->value.asNum.NumType == HB_ET_LONG ) - { - if( ( pArg->value.asNum.lVal % 256 ) == 0 && pArg->value.asNum.lVal != 0 ) - { - pExpr->value.asString.string = ( char * ) HB_XGRAB( 1 ); - pExpr->value.asString.string[ 0 ] = '\0'; - pExpr->value.asString.dealloc = TRUE; - pExpr->ulLength = 0; - } - else - { - pExpr->value.asString.string = ( char * ) HB_XGRAB( 2 ); - pExpr->value.asString.string[ 0 ] = ( pArg->value.asNum.lVal % 256 ); - pExpr->value.asString.string[ 1 ] = '\0'; - pExpr->value.asString.dealloc = TRUE; - pExpr->ulLength = 1; - } - } - else - { - pExpr->value.asString.string = ( char * ) HB_XGRAB( 2 ); - pExpr->value.asString.string[ 0 ] = ( ( long ) pArg->value.asNum.dVal % 256 ); - pExpr->value.asString.string[ 1 ] = '\0'; - pExpr->value.asString.dealloc = TRUE; - pExpr->ulLength = 1; - } - HB_EXPR_PCODE1( hb_compExprDelete, pParms ); - HB_EXPR_PCODE1( hb_compExprDelete, pName ); - } - } - else if( ( strcmp( "EVAL", pName->value.asSymbol ) == 0 ) && iCount ) + if( ( strcmp( "EVAL", pName->value.asSymbol ) == 0 ) && iCount ) { /* Optimize Eval( bBlock, [ArgList] ) to: bBlock:Eval( [ArgList] ) */ return hb_compExprNewMethodCall( hb_compExprNewSend( pParms->value.asList.pExprList, diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index 56fdcc2268..5027be4dd4 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -348,22 +348,34 @@ static HB_EXPR_FUNC( hb_compExprUseString ) break; case HB_EA_PUSH_PCODE: { - char *szDupl; - BOOL bUseTextSubst; - BOOL bValidMacro; + char *szDupl; + BOOL bUseTextSubst; + BOOL bValidMacro; - szDupl = hb_strupr( hb_strdup( pSelf->value.asString.string ) ); + szDupl = hb_strupr( hb_strdup( pSelf->value.asString.string ) ); HB_EXPR_PCODE2( hb_compGenPushString, pSelf->value.asString.string, pSelf->ulLength + 1 ); - bValidMacro = hb_compExprIsValidMacro( szDupl, &bUseTextSubst ); + bValidMacro = hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ); if( bUseTextSubst ) - { - if( bValidMacro ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT ); - else - hb_compErrorMacro( pSelf->value.asString.string ); - } - hb_xfree( szDupl ); + { + if( HB_SUPPORT_HARBOUR ) + { + if( bValidMacro ) + HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT ); + else + hb_compErrorMacro( pSelf->value.asString.string ); + } + else + { + /* Clipper always generates macro substitution pcode + * even if it is not a valid expression + */ + HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT ); + if( !bValidMacro ) + hb_compErrorMacro( pSelf->value.asString.string ); + } + } + hb_xfree( szDupl ); } break; case HB_EA_POP_PCODE: @@ -546,7 +558,7 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf ) HB_EXPR_PCODE0( hb_compCodeBlockStart ); szDupl = hb_strupr( hb_strdup( pSelf->value.asCodeblock.string ) ); - if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst ) ) + if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ) ) { hb_compErrorCodeblock( pSelf->value.asCodeblock.string ); hb_compErrorMacro( pSelf->value.asCodeblock.string ); @@ -1174,6 +1186,9 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) switch( iMessage ) { case HB_EA_REDUCE: + if( pSelf->value.asMacro.pExprList ) + pSelf->value.asMacro.pExprList = HB_EXPR_USE( pSelf->value.asMacro.pExprList, HB_EA_REDUCE ); + break; case HB_EA_ARRAY_AT: case HB_EA_ARRAY_INDEX: case HB_EA_LVALUE: @@ -1372,12 +1387,11 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) */ if( pSelf->value.asFunCall.pParms ) pSelf->value.asFunCall.pParms = HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_REDUCE ); - #ifndef HB_C52_STRICT + if( pSelf->value.asFunCall.pFunName->ExprType == HB_ET_FUNNAME ) { HB_EXPR_PTR pName = pSelf->value.asFunCall.pFunName; HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; - HB_EXPR_PTR pReduced; USHORT usCount; if( pParms ) @@ -1396,29 +1410,23 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) if( ( strcmp( "AT", pName->value.asSymbol ) == 0 ) && usCount == 2 ) { - HB_EXPR_PTR pSub = pParms->value.asList.pExprList; - HB_EXPR_PTR pText = pSub->pNext; - - if( pSub->ExprType == HB_ET_STRING && pText->ExprType == HB_ET_STRING ) - { - if( pSub->value.asString.string[0] == '\0' ) - { - pReduced = hb_compExprNewLong( 1 ); - } - else - { - pReduced = hb_compExprNewLong( hb_strAt( pSub->value.asString.string, pSub->ulLength, pText->value.asString.string, pText->ulLength ) ); - } - - HB_EXPR_PCODE1( hb_compExprDelete, pSelf->value.asFunCall.pFunName ); - HB_EXPR_PCODE1( hb_compExprDelete, pSelf->value.asFunCall.pParms ); - - memcpy( pSelf, pReduced, sizeof( HB_EXPR ) ); - HB_XFREE( pReduced ); - } + hb_compExprReduceAT( pSelf, HB_MACRO_PARAM ); } + else if( ( strcmp( "CHR", pName->value.asSymbol ) == 0 ) && usCount ) + { + hb_compExprReduceCHR( pSelf, HB_MACRO_PARAM ); + } + else if( ( strcmp( "LEN", pName->value.asSymbol ) == 0 ) && usCount ) + { + if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) ) + hb_compExprReduceLEN( pSelf, HB_MACRO_PARAM ); + } + else if( ( strcmp( "ASC", pName->value.asSymbol ) == 0 ) && usCount ) + { + if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) ) + hb_compExprReduceASC( pSelf, HB_MACRO_PARAM ); + } } - #endif } break; diff --git a/harbour/include/hbexprc.c b/harbour/include/hbexprc.c index d2caef2709..faf8c2984f 100644 --- a/harbour/include/hbexprc.c +++ b/harbour/include/hbexprc.c @@ -416,7 +416,7 @@ ULONG hb_compExprReduceList( HB_EXPR_PTR pExpr ) return ulCnt; } -BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst ) +BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst, HB_MACRO_DECL ) { char * pTmp = szText; BOOL bTextSubst; @@ -428,11 +428,15 @@ BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst ) /* Check if macro operator is used inside a string * Macro operator is ignored if it is the last char or * next char is '(' e.g. "this is &(ignored)" + * (except if strict Clipper compatibility mode is enabled) * * NOTE: This uses _a-zA-Z pattern to check for * beginning of a variable name */ + if( ! HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) ) + *pbUseTextSubst = TRUE; /* always macro substitution in Clipper */ + ++pTmp; bTextSubst = ( *pTmp == '_' || (*pTmp >= 'A' && *pTmp <= 'Z') || (*pTmp >= 'a' && *pTmp <= 'z') ); /* NOTE: All variables are assumed memvars in macro compiler - @@ -442,7 +446,7 @@ BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst ) { #if defined( HB_MACRO_SUPPORT ) HB_SYMBOL_UNUSED( bMacroText ); - *pbUseTextSubst = TRUE; /* valid macro expression */ + *pbUseTextSubst = TRUE; /* valid macro expression */ return TRUE; /*there is no need to check all '&' occurences */ #else /* There is a valid character after '&' that can be used in diff --git a/harbour/include/hbexprop.h b/harbour/include/hbexprop.h index 6519f34497..b2a2d2d430 100644 --- a/harbour/include/hbexprop.h +++ b/harbour/include/hbexprop.h @@ -371,9 +371,13 @@ int hb_compExprType( HB_EXPR_PTR ); void hb_compExprFree( HB_EXPR_PTR, HB_MACRO_DECL ); void hb_compExprErrorType( HB_EXPR_PTR, HB_MACRO_DECL ); HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR, HB_MACRO_DECL ); -BOOL hb_compExprIsValidMacro( char *, BOOL * ); void hb_compExprCBVarDel( HB_CBVAR_PTR ); HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR, HB_EXPR_PTR, HB_MACRO_DECL ); +BOOL hb_compExprReduceAT( HB_EXPR_PTR, HB_MACRO_DECL ); +BOOL hb_compExprReduceCHR( HB_EXPR_PTR, HB_MACRO_DECL ); +BOOL hb_compExprReduceLEN( HB_EXPR_PTR, HB_MACRO_DECL ); +BOOL hb_compExprReduceASC( HB_EXPR_PTR, HB_MACRO_DECL ); +BOOL hb_compExprIsValidMacro( char *, BOOL *, HB_MACRO_DECL ); #ifdef HB_MACRO_SUPPORT @@ -385,7 +389,7 @@ HB_EXPR_PTR hb_compExprGenStatement( HB_EXPR_PTR, HB_MACRO_DECL ); HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR, HB_EXPR_PTR, HB_MACRO_DECL ); HB_EXPR_PTR hb_compExprCBVarAdd( HB_EXPR_PTR, char *, HB_MACRO_DECL ); void hb_compExprDelete( HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr, HB_MACRO_DECL ); +HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr, HB_MACRO_DECL ); #else diff --git a/harbour/source/common/expropt1.c b/harbour/source/common/expropt1.c index 6b5b84cbee..eb97493271 100644 --- a/harbour/source/common/expropt1.c +++ b/harbour/source/common/expropt1.c @@ -396,7 +396,7 @@ HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR pMacroExpr, unsigned char cMacroOp, BOOL bUseTextSubst; szDupl = hb_strupr( hb_strdup( szName ) ); - if( ! hb_compExprIsValidMacro( szDupl, &bUseTextSubst ) ) + if( ! hb_compExprIsValidMacro( szDupl, &bUseTextSubst, NULL ) ) hb_compErrorMacro( szName ); hb_xfree( szDupl ); diff --git a/harbour/source/common/expropt2.c b/harbour/source/common/expropt2.c index 560a842b9a..b001b18a55 100644 --- a/harbour/source/common/expropt2.c +++ b/harbour/source/common/expropt2.c @@ -432,21 +432,30 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } else if( pLeft->ExprType == HB_ET_STRING && pRight->ExprType == HB_ET_STRING ) { - pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */ - hb_compExprFree( pSelf, HB_MACRO_PARAM ); if( pRight->ulLength == 0 ) { + pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */ + hb_compExprFree( pSelf, HB_MACRO_PARAM ); pSelf = pLeft; hb_compExprFree( pRight, HB_MACRO_PARAM ); } else if( pLeft->ulLength == 0 ) { + pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */ + hb_compExprFree( pSelf, HB_MACRO_PARAM ); pSelf = pRight; hb_compExprFree( pLeft, HB_MACRO_PARAM ); } else { - pSelf = hb_compExprReducePlusStrings( pLeft, pRight, HB_MACRO_PARAM ); + /* Do not reduce strings with the macro operator '&' + */ + if( strchr(pLeft->value.asString.string, '&') == NULL ) + { + pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */ + hb_compExprFree( pSelf, HB_MACRO_PARAM ); + pSelf = hb_compExprReducePlusStrings( pLeft, pRight, HB_MACRO_PARAM ); + } } } else @@ -1125,3 +1134,123 @@ HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } +BOOL hb_compExprReduceAT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +{ + HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; + HB_EXPR_PTR pSub = pParms->value.asList.pExprList; + HB_EXPR_PTR pText = pSub->pNext; + HB_EXPR_PTR pReduced; + + if( pSub->ExprType == HB_ET_STRING && pText->ExprType == HB_ET_STRING ) + { + if( pSub->value.asString.string[0] == '\0' ) + { + pReduced = hb_compExprNewLong( 1 ); + } + else + { + pReduced = hb_compExprNewLong( hb_strAt( pSub->value.asString.string, pSub->ulLength, pText->value.asString.string, pText->ulLength ) ); + } + + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pParms, HB_MACRO_PARAM ); + + memcpy( pSelf, pReduced, sizeof( HB_EXPR ) ); + hb_xfree( pReduced ); + return TRUE; + } + else + return FALSE; +} + +BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +{ + HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; + HB_EXPR_PTR pArg = pParms->value.asList.pExprList; + HB_EXPR_PTR pExpr = NULL; + /* try to change it into a string */ + + if( pArg->ExprType == HB_ET_NUMERIC ) + { + /* NOTE: CA-Cl*pper's compiler optimizer will be wrong for those + CHR() cases where the passed parameter is a constant which + can be divided by 256 but it's not zero, in this case it + will return an empty string instead of a Chr(0). [vszakats] */ + + pExpr = hb_compExprNew( HB_ET_STRING ); + pExpr->ValType = HB_EV_STRING; + if( pArg->value.asNum.NumType == HB_ET_LONG ) + { + BYTE bVal; + bVal = ( pArg->value.asNum.lVal % 256 ); + + if( bVal == 0 && pArg->value.asNum.lVal != 0 ) + { + pExpr->value.asString.string = ( char * ) hb_xgrab( 1 ); + pExpr->value.asString.string[ 0 ] = '\0'; + pExpr->value.asString.dealloc = TRUE; + pExpr->ulLength = 0; + } + else + { + pExpr->value.asString.string = ( char * ) hb_xgrab( 2 ); + pExpr->value.asString.string[ 0 ] = bVal; + pExpr->value.asString.string[ 1 ] = '\0'; + pExpr->value.asString.dealloc = TRUE; + pExpr->ulLength = 1; + } + } + else + { + pExpr->value.asString.string = ( char * ) hb_xgrab( 2 ); + pExpr->value.asString.string[ 0 ] = ( ( long ) pArg->value.asNum.dVal % 256 ); + pExpr->value.asString.string[ 1 ] = '\0'; + pExpr->value.asString.dealloc = TRUE; + pExpr->ulLength = 1; + } + + hb_compExprFree( pParms, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); + hb_xfree( pExpr ); + return TRUE; + } + + return FALSE; +} + +BOOL hb_compExprReduceLEN( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +{ + HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; + HB_EXPR_PTR pArg = pParms->value.asList.pExprList; + + if( pArg->ExprType == HB_ET_STRING || pArg->ExprType == HB_ET_ARRAY ) + { + HB_EXPR_PTR pExpr = hb_compExprNewLong( pArg->ulLength ); + + hb_compExprFree( pParms, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); + hb_xfree( pExpr ); + return TRUE; + } + return FALSE; +} + +BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +{ + HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; + HB_EXPR_PTR pArg = pParms->value.asList.pExprList; + + if( pArg->ExprType == HB_ET_STRING ) + { + HB_EXPR_PTR pExpr = hb_compExprNewLong( pArg->value.asString.string[0] ); + + hb_compExprFree( pParms, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); + hb_xfree( pExpr ); + return TRUE; + } + return FALSE; +} diff --git a/harbour/source/compiler/expropta.c b/harbour/source/compiler/expropta.c index ccdaea36cb..c97a2d116e 100644 --- a/harbour/source/compiler/expropta.c +++ b/harbour/source/compiler/expropta.c @@ -5,6 +5,6 @@ /* hbexpra.c is also included from ../macro/macro.c * However it produces a slighty different code if used in * macro compiler (there is an additional parameter passed to some functions) - * 8 - ignore this magic number - this is used to force compilation + * 1.9 - ignore this magic number - this is used to force compilation */ #include "hbexpra.c" diff --git a/harbour/source/compiler/exproptb.c b/harbour/source/compiler/exproptb.c index 2d17d59091..2b34d50e26 100644 --- a/harbour/source/compiler/exproptb.c +++ b/harbour/source/compiler/exproptb.c @@ -5,6 +5,6 @@ /* hbexprb.c is also included from ../macro/macro.c * However it produces a slighty different code if used in * macro compiler (there is an additional parameter passed to some functions) - * 1.7 - ignore this magic number - this is used to force compilation + * 1.8 - ignore this magic number - this is used to force compilation */ #include "hbexprb.c" diff --git a/harbour/source/compiler/exproptc.c b/harbour/source/compiler/exproptc.c index 1bf1a188ce..e50897e4bb 100644 --- a/harbour/source/compiler/exproptc.c +++ b/harbour/source/compiler/exproptc.c @@ -5,6 +5,6 @@ /* hbexprc.c is also included from ../macro/macro.c * However it produces a slighty different code if used in * macro compiler (there is an additional parameter passed to some functions) - * 5 - ignore this magic number - this is used to force compilation + * 1.5 - ignore this magic number - this is used to force compilation */ #include "hbexprc.c" diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index fcc0186783..599ae23e37 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -191,7 +191,6 @@ int main( int argc, char * argv[] ) hb_comp_Supported = HB_COMPFLAG_HARBOUR; hb_comp_Supported |= HB_COMPFLAG_XBASE; hb_comp_Supported |= HB_COMPFLAG_HB_INLINE; - hb_comp_Supported |= HB_COMPFLAG_ARRSTR; /* First check the environment variables */ hb_compChkCompilerSwitch( 0, NULL ); diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index eff1c92f75..7f96edefde 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -389,17 +389,20 @@ Separator {SpaceTab} unput( yytext[ yyleng-1 ] ); return BREAK; } -%{ +[\[] { BEGIN 0; /* NOTE: Clipper does not like break[] in any context * There are no resons to limit this use in Harbour. */ -/* -[\[] { BEGIN 0; unput( yytext[ yyleng-1 ] ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, yytext, NULL ); + if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_HARBOUR ) ) + { + yylval.string = hb_compIdentifierNew( "BREAK", TRUE ); + hb_comp_iState =IDENTIFIER; + return IDENTIFIER; + } + else + hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, yytext, NULL ); } -*/ -%} (":="|"+="|"-="|"->"|"*="|"/="|"^="|"==") { /* operators */ BEGIN 0; yylval.string = hb_compIdentifierNew( "BREAK", TRUE ); diff --git a/harbour/source/macro/macroa.c b/harbour/source/macro/macroa.c index baa43ea3ef..afa35edbc7 100644 --- a/harbour/source/macro/macroa.c +++ b/harbour/source/macro/macroa.c @@ -5,7 +5,7 @@ /* hbexpra.c is also included from ../compiler/expropta.c * However it produces a slighty different code if used in * macro compiler (there is an additional parameter passed to some functions) - * 8 - ignore this magic number - this is used to force compilation + * 1.9 - ignore this magic number - this is used to force compilation */ #define HB_MACRO_SUPPORT diff --git a/harbour/source/macro/macrob.c b/harbour/source/macro/macrob.c index cddf0da718..ef5558a09c 100644 --- a/harbour/source/macro/macrob.c +++ b/harbour/source/macro/macrob.c @@ -5,7 +5,7 @@ /* hbexprb.c is also included from ../compiler/exproptb.c * However it produces a slighty different code if used in * macro compiler (there is an additional parameter passed to some functions) - * 1.6 - ignore this magic number - this is used to force compilation + * 1.7 - ignore this magic number - this is used to force compilation */ #define HB_MACRO_SUPPORT diff --git a/harbour/source/macro/macroc.c b/harbour/source/macro/macroc.c index 87ae84f27f..81a8872b18 100644 --- a/harbour/source/macro/macroc.c +++ b/harbour/source/macro/macroc.c @@ -5,7 +5,7 @@ /* hbexprc.c is also included from ../compiler/exproptc.c * However it produces a slighty different code if used in * macro compiler (there is an additional parameter passed to some functions) - * 2 - ignore this magic number - this is used to force compilation + * 1.4 - ignore this magic number - this is used to force compilation */ #define HB_MACRO_SUPPORT diff --git a/harbour/source/vm/cmdarg.c b/harbour/source/vm/cmdarg.c index 83634b180c..153bcfa5b3 100644 --- a/harbour/source/vm/cmdarg.c +++ b/harbour/source/vm/cmdarg.c @@ -287,7 +287,7 @@ HB_FUNC( HB_ARGV ) ULONG hb_cmdargProcessVM( int *pCancelKey, int *pCancelKeyEx ) { char * cFlags; - ULONG ulFlags = (HB_VMFLAG_HARBOUR | HB_VMFLAG_ARRSTR); + ULONG ulFlags = HB_VMFLAG_HARBOUR; if( hb_cmdargCheck( "INFO" ) ) { diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 39bfe71d1e..7b0b9c3a7e 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -225,7 +225,7 @@ static BOOL s_bDebuggerIsWorking; /* to know when __DBGENTRY is beeing invok /* Various compatibility flags */ -static ULONG s_VMFlags; +static ULONG s_VMFlags = HB_VMFLAG_HARBOUR; #undef hb_vmFlagEnabled #define hb_vmFlagEnabled(flag) (s_VMFlags & (flag))