diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f9fcab2f46..9e607499d2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,24 @@ +2001-07-21 16:15 UTC+0100 Ryszard Glab + + *include/hbexpra.c + *include/hbexprb.c + *include/hbexprc.c + *include/hbexprop.h + *source/common/expropt1.c + *fixed support for &alias->( expression ) + *removed global variables that were breaking modularity of the code + *fixed support for syntax: SomeFun( ¯o + someValue ) + + *source/compiler/harbour.y + *removed access to internal HB_EXPR structure data + + *source/rtl/checkbox.prg + * added 'LOCAL oCheck' to compile without warnings + + *source/rtl/gtsln/gtsln.c + *fixed to support (at least) SLang version 1.3.8 + + 2001-07-21 09:20 GMT -3 Luiz Rafael Culik *source/rtl/checkbox.prg *lowercased the include file names diff --git a/harbour/include/hbexpra.c b/harbour/include/hbexpra.c index 07117d1066..dd57dcaf45 100644 --- a/harbour/include/hbexpra.c +++ b/harbour/include/hbexpra.c @@ -129,9 +129,6 @@ static BYTE s_PrecedTable[] = { HB_ET_NIL /* HB_EO_PREDEC, pre-operators */ }; -BOOL hb_exp_bArgList = FALSE; -HB_EXPR_PTR hb_exp_pSelf; - static HB_CBVAR_PTR hb_compExprCBVarNew( char *, BYTE ); /* ************************************************************************ */ diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index 3ac607b1d3..f7172a4688 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -218,9 +218,6 @@ HB_EXPR_FUNC_PTR hb_comp_ExprTable[] = { hb_compExprUsePreDec /* highest precedence */ }; -extern BOOL hb_exp_bArgList; -extern HB_EXPR_PTR hb_exp_pSelf; - /* ************************************************************************* */ static HB_EXPR_FUNC( hb_compExprUseDummy ) @@ -1005,10 +1002,10 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROSYMBOL ); else if( pSelf->value.asMacro.SubType != HB_ET_MACRO_ALIASED ) { - if( hb_exp_bArgList ) + if( pSelf->value.asMacro.SubType & HB_ET_MACRO_ARGLIST ) { HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHARG ); - HB_EXPR_USE( hb_exp_pSelf->value.asFunCall.pFunName, HB_EA_PUSH_PCODE ); + HB_EXPR_USE( pSelf->value.asMacro.pFunCall->value.asFunCall.pFunName, HB_EA_PUSH_PCODE ); } else { @@ -1113,10 +1110,18 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) --usCount; if( usCount ) { - hb_exp_bArgList = TRUE; - hb_exp_pSelf = pSelf; + /* check if ¯o is used as a function call argument */ + HB_EXPR_PTR pExpr = pSelf->value.asFunCall.pParms->value.asList.pExprList; + while( pExpr ) + { + if( pExpr->ExprType == HB_ET_MACRO ) + { + pExpr->value.asMacro.SubType |= HB_ET_MACRO_ARGLIST; + pExpr->value.asMacro.pFunCall = pSelf; + } + pExpr = pExpr->pNext; + } HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_PUSH_PCODE ); - hb_exp_bArgList = FALSE; } } else @@ -1147,10 +1152,19 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) --usCount; if( usCount ) { - hb_exp_bArgList = TRUE; - hb_exp_pSelf = pSelf; + HB_EXPR_PTR pExpr = pSelf->value.asFunCall.pParms->value.asList.pExprList; + /* check if ¯o is used as a function call argument */ + while( pExpr ) + { + if( pExpr->ExprType == HB_ET_MACRO ) + { + /* ¯o was passed - handle it differently then in a normal statement */ + pExpr->value.asMacro.SubType |= HB_ET_MACRO_ARGLIST; + pExpr->value.asMacro.pFunCall = pSelf; + } + pExpr = pExpr->pNext; + } HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_PUSH_PCODE ); - hb_exp_bArgList = FALSE; } } else @@ -1724,17 +1738,11 @@ static HB_EXPR_FUNC( hb_compExprUseAssign ) { /* it assigns a value and leaves it on the stack */ - /* Temporarily disable HB_P_MACROPUSHARG support. */ - BOOL bArg = hb_exp_bArgList; hb_exp_bArgList = FALSE; - HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); /* QUESTION: Can we replace DUPLICATE+POP with a single PUT opcode */ HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_POP_PCODE ); - - /* Restore HB_P_MACROPUSHARG support. */ - hb_exp_bArgList = bArg; } } break; diff --git a/harbour/include/hbexprc.c b/harbour/include/hbexprc.c index 7e4e96a250..75ca36b7bd 100644 --- a/harbour/include/hbexprc.c +++ b/harbour/include/hbexprc.c @@ -88,10 +88,6 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_MACRO_DECL ) void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) #endif { - extern BOOL hb_exp_bArgList; - /* Temporarily disable HB_P_MACROPUSHARG support. */ - BOOL bArg = hb_exp_bArgList; hb_exp_bArgList = FALSE; - /* NOTE: an object instance variable needs special handling */ if( pSelf->value.asOperator.pLeft->ExprType == HB_ET_SEND ) @@ -165,10 +161,6 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) /* pop the new value into variable and leave the copy on the stack */ HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_POP_PCODE ); } - - /* Restore HB_P_MACROPUSHARG support. */ - hb_exp_bArgList = bArg; - } /* Generates pcodes for = syntax diff --git a/harbour/include/hbexprop.h b/harbour/include/hbexprop.h index feddfcce9c..4d06405b42 100644 --- a/harbour/include/hbexprop.h +++ b/harbour/include/hbexprop.h @@ -99,6 +99,7 @@ typedef enum #define HB_ET_MACRO_SYMBOL 1 /* &fimcall() */ #define HB_ET_MACRO_ALIASED 2 /* &alias->&variable */ #define HB_ET_MACRO_EXPR 4 /* &( expr ) */ +#define HB_ET_MACRO_ARGLIST 8 /* &variable used as a function call argument */ /* types of expressions * NOTE: the order of these definition is important - change it carefully @@ -193,6 +194,7 @@ typedef struct HB_EXPR_ unsigned char SubType; /* context in which macro is used */ char * szMacro; /* identifier after the macro operator */ struct HB_EXPR_ *pExprList; /* list elements if &(...) was used */ + struct HB_EXPR_ *pFunCall; /* pointer to a function if used as function's call argument */ } asMacro; struct { diff --git a/harbour/source/common/expropt1.c b/harbour/source/common/expropt1.c index 534fc13110..890ede5f22 100644 --- a/harbour/source/common/expropt1.c +++ b/harbour/source/common/expropt1.c @@ -429,6 +429,13 @@ HB_EXPR_PTR hb_compExprNewAliasExpr( HB_EXPR_PTR pAlias, HB_EXPR_PTR pExpList ) pExpr->value.asAlias.pAlias = pAlias; pExpr->value.asAlias.pExpList = pExpList; pExpr->value.asAlias.pVar = NULL; + + if( pAlias->ExprType == HB_ET_MACRO ) + { + /* Is it a special case &variable->( expressionList ) */ + if( pAlias->value.asMacro.SubType == HB_ET_MACRO_VAR ) + pAlias->value.asMacro.SubType = HB_ET_MACRO_ALIASED; + } return pExpr; } diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index fe1a7c89da..75fb48681f 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -514,7 +514,7 @@ MacroVar : MACROVAR { $$ = hb_compExprNewMacro( NULL, '&', $1 ); } | MACROTEXT { $$ = hb_compExprNewMacro( NULL, 0, $1 ); } ; -MacroVarAlias : MacroVar ALIASOP { $$ = $1; $$->value.asMacro.SubType = HB_ET_MACRO_SYMBOL; } +MacroVarAlias : MacroVar ALIASOP { $$ = $1; } ; /* Macro expressions diff --git a/harbour/source/rtl/checkbox.prg b/harbour/source/rtl/checkbox.prg index 2a1f8ab8f7..4ffd327577 100644 --- a/harbour/source/rtl/checkbox.prg +++ b/harbour/source/rtl/checkbox.prg @@ -199,9 +199,10 @@ function __GUICOLOR( cPair, nPos ) ccolor := SubStr(ccolor, 1, nCommaPos - 1) endif return ccolor -function _CHECKBOX_( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) - local Local1, Local2, Local3, Local4 +function _CHECKBOX_( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) +LOCAL oCheck + oCheck := checkbox(Row(), Col(), Arg2) if ( !( ISNIL( oCheck ) ) ) oCheck:select(Arg1) diff --git a/harbour/source/rtl/gtsln/gtsln.c b/harbour/source/rtl/gtsln/gtsln.c index fbca05bfa5..6671fc2a9c 100644 --- a/harbour/source/rtl/gtsln/gtsln.c +++ b/harbour/source/rtl/gtsln/gtsln.c @@ -60,13 +60,13 @@ #include #endif -/* missing defines in previous versions of Slang - this can not work ! */ -#if SLANG_VERSION < 10400 typedef unsigned short SLsmg_Char_Type; #define SLSMG_EXTRACT_CHAR( x ) ( ( x ) & 0xFF ) #define SLSMG_EXTRACT_COLOR( x ) ( ( ( x ) >> 8 ) & 0xFF ) #define SLSMG_BUILD_CHAR( ch, color ) ( ( ( SLsmg_Char_Type ) ( unsigned char )( ch ) ) | ( ( color ) << 8 ) ) +/* missing defines in previous versions of Slang - this can not work ! */ +#if SLANG_VERSION < 10308 #define SLSMG_DIAMOND_CHAR 0x04 #define SLSMG_DEGREE_CHAR 0xF8 #define SLSMG_PLMINUS_CHAR 0xF1