diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c8bdcf0dec..2dad4edb59 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +20000214-19:35 GMT+1 Ryszard Glab + + *source/compiler/expropt.c + *source/macro/macro.c + *include/hbexpr.c + * fixed generation of incorrect HB_P_MACROSYMBOL pcode when + &( expression ) syntax was used + + *tests/tstmacro.prg + * cleared to allow Clipper compatible syntax only + 20000214-17:10 GMT+1 Victor Szakats * config/w32/bcc32.cf ! Fixed so that it doesn't require the non-standard HARBOURDIR envvar diff --git a/harbour/include/hbexpr.c b/harbour/include/hbexpr.c index 08b0408628..1644a720d1 100644 --- a/harbour/include/hbexpr.c +++ b/harbour/include/hbexpr.c @@ -125,6 +125,7 @@ typedef enum #define HB_ET_MACRO_VAR 0 /* &variable */ #define HB_ET_MACRO_SYMBOL 1 /* &fimcall() */ #define HB_ET_MACRO_ALIASED 2 /* &alias->&variable */ +#define HB_ET_MACRO_EXPR 4 /* &( expr ) */ /* types of expressions * NOTE: the order of these definition is important - change it carefully @@ -935,6 +936,7 @@ HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR pMacroExpr, unsigned char cMacroOp, pExpr = hb_compExprNew( HB_ET_MACRO ); pExpr->value.asMacro.pExprList = pMacroExpr; pExpr->value.asMacro.szMacro = NULL; /* this is used to distinguish &(...) from &ident */ + pExpr->value.asMacro.SubType = HB_ET_MACRO_EXPR; } return pExpr; diff --git a/harbour/source/compiler/expropt.c b/harbour/source/compiler/expropt.c index 2c6299dbcc..043e303fa6 100644 --- a/harbour/source/compiler/expropt.c +++ b/harbour/source/compiler/expropt.c @@ -5,6 +5,6 @@ /* hbexpr.c is also included from ../macro/macro.c * However it produces a slighty different code if used in * macro compiler - * 2 - ignore this magic number - this is used to force compilation + * 3 - ignore this magic number - this is used to force compilation */ #include "hbexpr.c" diff --git a/harbour/source/macro/macro.c b/harbour/source/macro/macro.c index e63ba95492..03ef6202ba 100644 --- a/harbour/source/macro/macro.c +++ b/harbour/source/macro/macro.c @@ -1254,7 +1254,7 @@ void hb_compCodeBlockEnd( HB_MACRO_DECL ) * NOTE: It cannot be compiled into a single library because the code * required for macro compiler differs a little - we are passing additional * parameter that holds macro compiler internal data - * 2 - ignore this magic number - it forces the compilation of this file + * 3 - ignore this magic number - it forces the compilation of this file */ #include "hbexpr.c" diff --git a/harbour/tests/tstmacro.prg b/harbour/tests/tstmacro.prg index 9bf635e40e..8269ed4c83 100644 --- a/harbour/tests/tstmacro.prg +++ b/harbour/tests/tstmacro.prg @@ -6,7 +6,7 @@ Function Main( ) - LOCAL cStr := 'cVar', cStr_1 := 'cVar_1', aVar := { 'cVar_1' }, oVar + PRIVATE cStr := 'cVar', cStr_1 := 'cVar_1', aVar := { 'cVar_1' }, oVar PRIVATE cVar_1, cMainPrivate := 'cVar_1', GlobalPrivate := 'BornInRunTimeVar' @@ -30,12 +30,12 @@ Function Main( ) &cStr._1 = 'Concatenated Macro (String)' ? M->cVar_1 - &aVar[1] := 'Array Macro' + &( aVar[1] ) := 'Array Macro' ? M->cVar_1 oVar := TValue():New() oVar:cVal := 'cVar_1' - &oVar:cVal := 'Class Macro' + &( oVar:cVal ) := 'Class Macro' ? M->cVar_1 SubFun() @@ -74,7 +74,8 @@ Function SubFun() // Testing conflict with KEY WORDS PRIVATE PRIVATE := 'I am a Var named PRIVATE ', &cMainPrivate, SomeVar, OtherVar := 1, &GlobalPrivate := 'I was born in Run Time' - PUBLIC PUBLIC := 'My Name is PUBLIC', &( 'NewPublicVar' ) := 'Test Inline Assignment' + PUBLIC PUBLIC := 'NewPublicVar' + PUBLIC &PUBLIC ? M->NewPublicVar @@ -89,4 +90,4 @@ Function SubFun() ? '"cVar_1" = [' + M->cVar_1 + '] in SubFun() PRIVATE' -RETURN +RETURN NIL