2009-07-03 02:24 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/macro/macro.y
* harbour/source/macro/macro.yyc
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
% reduced INASSING definition - thanks to Xavi for information
* harbour/source/compiler/hbopt.c
! fixed stupid bug in logical expression optimization - thanks to Randy
for self contain example
* harbour/include/hbapi.h
* harbour/include/hbmacro.h
* harbour/include/hbexprb.c
* harbour/source/vm/macro.c
* harbour/source/vm/hvm.c
* harbour/source/macro/macro.y
* harbour/source/macro/macro.yyc
+ added direct support for pushing references to macro expressions.
It resolves the problem with Clipper compatibility (thanks to Alex
for information and example) in code like:
m->var := {0}
&("var[1]") += 10
and also many other things, f.e. now Harbour can cleanly compile
and execute this code:
proc main
local s
m->o := errorNew()
s:="o:tries"
? m->o:tries
? &s
? &(s+"+=2")
? m->o:tries
? &(s+":=3")
? m->o:tries
?
&s := 4
? m->o:tries
&s -= 2
? m->o:tries
&s++
? m->o:tries
?
s := "o"
m->o := 1
? &s
&s := &s + 4
? &s
? &s += 5
? --&s
?
s := "o[2]"
m->o := { 1, 2 }
? &s
&s := &s + 4
? &s
? &s += 5
? --&s
return
* harbour/utils/hbtest/Makefile
* force hbtest compilation with line numbers - information about line
numbers is important part of this test.
This commit is contained in:
@@ -17,6 +17,70 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-07-03 02:24 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/macro/macro.y
|
||||
* harbour/source/macro/macro.yyc
|
||||
* harbour/source/compiler/harbour.y
|
||||
* harbour/source/compiler/harbour.yyc
|
||||
% reduced INASSING definition - thanks to Xavi for information
|
||||
|
||||
* harbour/source/compiler/hbopt.c
|
||||
! fixed stupid bug in logical expression optimization - thanks to Randy
|
||||
for self contain example
|
||||
|
||||
* harbour/include/hbapi.h
|
||||
* harbour/include/hbmacro.h
|
||||
* harbour/include/hbexprb.c
|
||||
* harbour/source/vm/macro.c
|
||||
* harbour/source/vm/hvm.c
|
||||
* harbour/source/macro/macro.y
|
||||
* harbour/source/macro/macro.yyc
|
||||
+ added direct support for pushing references to macro expressions.
|
||||
It resolves the problem with Clipper compatibility (thanks to Alex
|
||||
for information and example) in code like:
|
||||
m->var := {0}
|
||||
&("var[1]") += 10
|
||||
and also many other things, f.e. now Harbour can cleanly compile
|
||||
and execute this code:
|
||||
proc main
|
||||
local s
|
||||
m->o := errorNew()
|
||||
s:="o:tries"
|
||||
? m->o:tries
|
||||
? &s
|
||||
? &(s+"+=2")
|
||||
? m->o:tries
|
||||
? &(s+":=3")
|
||||
? m->o:tries
|
||||
?
|
||||
&s := 4
|
||||
? m->o:tries
|
||||
&s -= 2
|
||||
? m->o:tries
|
||||
&s++
|
||||
? m->o:tries
|
||||
?
|
||||
s := "o"
|
||||
m->o := 1
|
||||
? &s
|
||||
&s := &s + 4
|
||||
? &s
|
||||
? &s += 5
|
||||
? --&s
|
||||
?
|
||||
s := "o[2]"
|
||||
m->o := { 1, 2 }
|
||||
? &s
|
||||
&s := &s + 4
|
||||
? &s
|
||||
? &s += 5
|
||||
? --&s
|
||||
return
|
||||
|
||||
* harbour/utils/hbtest/Makefile
|
||||
* force hbtest compilation with line numbers - information about line
|
||||
numbers is important part of this test.
|
||||
|
||||
2009-07-02 09:24 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/hbxbp/tests/demoxbp.prg
|
||||
* contrib/hbxbp/xbpstatic.prg
|
||||
|
||||
@@ -1066,6 +1066,7 @@ typedef void * HB_MACRO_PTR;
|
||||
#endif
|
||||
extern void hb_macroGetValue( HB_ITEM_PTR pItem, BYTE iContext, BYTE flags ); /* retrieve results of a macro expansion */
|
||||
extern void hb_macroSetValue( HB_ITEM_PTR pItem, BYTE flags ); /* assign a value to a macro-expression item */
|
||||
extern void hb_macroPushReference( HB_ITEM_PTR pItem ); /* push reference to given expression */
|
||||
extern void hb_macroTextValue( HB_ITEM_PTR pItem ); /* macro text substitution */
|
||||
extern void hb_macroPushSymbol( HB_ITEM_PTR pItem ); /* handle a macro function calls, e.g. var := ¯o() */
|
||||
extern void hb_macroRun( HB_MACRO_PTR pMacro ); /* executes pcode compiled by macro compiler */
|
||||
|
||||
@@ -836,6 +836,13 @@ static HB_EXPR_FUNC( hb_compExprUseRef )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( pExp->ExprType == HB_ET_VARIABLE )
|
||||
{
|
||||
pExp->ExprType = HB_ET_VARREF;
|
||||
HB_EXPR_USE( pExp, HB_EA_PUSH_PCODE );
|
||||
pExp->ExprType = HB_ET_VARIABLE;
|
||||
break;
|
||||
}
|
||||
else if( pExp->ExprType == HB_ET_ALIASVAR )
|
||||
{
|
||||
if( pExp->value.asAlias.pVar->ExprType == HB_ET_VARIABLE &&
|
||||
|
||||
@@ -78,6 +78,7 @@ HB_EXTERN_BEGIN
|
||||
#define HB_MACRO_GEN_TYPE 8 /* check the type of expression (from TYPE() function) */
|
||||
#define HB_MACRO_GEN_PARE 16 /* generate parentesized list */
|
||||
#define HB_MACRO_GEN_LIST 32 /* generate push operation for every comma separated expressions */
|
||||
#define HB_MACRO_GEN_REFER 64 /* generate PUSH pcodes for reference to given expression */
|
||||
#define HB_MACRO_DEALLOCATE 128 /* macro structure is allocated on the heap */
|
||||
|
||||
/* values returned from compilation process
|
||||
|
||||
@@ -951,49 +951,28 @@ ExprUnary : NOT Expression { $$ = hb_compExprNewNot( $2, HB_CO
|
||||
| '+' Expression %prec UNARY { $$ = $2; }
|
||||
;
|
||||
|
||||
ExprAssign : NumValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| NilValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| DateValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| TimeStampValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| LiteralValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| CodeBlock INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| Logical INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| SelfValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| Array INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| ArrayAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| Hash INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| AliasVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| AliasExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| MacroVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| MacroExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| Variable INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| VariableAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| PareExpList INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| IfInline INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| FunCall INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| ObjectData INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| ObjectMethod INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
ExprEqual : LeftExpression '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprEqual : LeftExpression '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
ExprAssign : LeftExpression INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprPlusEq : LeftExpression PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprPlusEq : LeftExpression PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprMinusEq : LeftExpression MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprMinusEq : LeftExpression MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprMultEq : LeftExpression MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprMultEq : LeftExpression MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprDivEq : LeftExpression DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprDivEq : LeftExpression DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprModEq : LeftExpression MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprModEq : LeftExpression MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprExpEq : LeftExpression EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprExpEq : LeftExpression EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprOperEq : ExprPlusEq
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -273,7 +273,7 @@ static HB_OPT_FUNC( hb_p_true )
|
||||
if( ! hb_compHasJump( pFunc, lPCodePos + 1 ) )
|
||||
{
|
||||
int iCount = 1;
|
||||
|
||||
|
||||
switch( pFunc->pCode[ lPCodePos + 1 ] )
|
||||
{
|
||||
case HB_P_JUMPTRUENEAR:
|
||||
@@ -321,7 +321,7 @@ static HB_OPT_FUNC( hb_p_duplicate )
|
||||
BYTE * pAddr = &pFunc->pCode[ lPCodePos + 2 ];
|
||||
LONG lOffset = HB_PCODE_MKINT24( pAddr ), lLastOffset = 0;
|
||||
ULONG ulNewPos = lPCodePos + 1 + lOffset;
|
||||
BOOL fNot = FALSE, fRepeat = TRUE;
|
||||
BOOL fNot = FALSE, fOK = TRUE, fRepeat = TRUE;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -341,6 +341,7 @@ static HB_OPT_FUNC( hb_p_duplicate )
|
||||
ulNewPos++;
|
||||
lOffset++;
|
||||
fNot = !fNot;
|
||||
fOK = !fOK;
|
||||
}
|
||||
else if( pFunc->pCode[ ulNewPos ] == HB_P_DUPLICATE &&
|
||||
( pFunc->pCode[ ulNewPos + 1 ] == HB_P_JUMPTRUEFAR ||
|
||||
@@ -355,9 +356,13 @@ static HB_OPT_FUNC( hb_p_duplicate )
|
||||
fRepeat = lJump > 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fRepeat = FALSE;
|
||||
if( pFunc->pCode[ ulNewPos ] == HB_P_POP )
|
||||
fOK = TRUE;
|
||||
}
|
||||
|
||||
if( !fNot )
|
||||
if( fOK )
|
||||
lLastOffset = lOffset;
|
||||
}
|
||||
while( fRepeat );
|
||||
|
||||
@@ -252,7 +252,9 @@ static void hb_macroIdentNew( HB_COMP_DECL, char * );
|
||||
|
||||
Main : Expression {
|
||||
HB_MACRO_DATA->exprType = hb_compExprType( $1 );
|
||||
if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PUSH )
|
||||
if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_REFER )
|
||||
hb_macroExprGenPush( hb_compExprNewRef( $1, HB_COMP_PARAM ), HB_COMP_PARAM );
|
||||
else if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PUSH )
|
||||
hb_macroExprGenPush( $1, HB_COMP_PARAM );
|
||||
else
|
||||
hb_macroExprGenPop( $1, HB_COMP_PARAM );
|
||||
@@ -574,7 +576,7 @@ LeftExpression : NumValue
|
||||
| PareExpList
|
||||
| FunCall
|
||||
| IfInline
|
||||
| ObjectData
|
||||
| ObjectData { HB_MACRO_IFENABLED( $$, $1, HB_SM_HARBOUR ); }
|
||||
| ObjectMethod
|
||||
;
|
||||
|
||||
@@ -600,46 +602,25 @@ ExprUnary : NOT Expression { $$ = hb_compExprNewNot( $2, HB_CO
|
||||
| '+' Expression %prec UNARY { $$ = $2; }
|
||||
;
|
||||
|
||||
ExprAssign : NumValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| NilValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| DateValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| TimeStampValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| LiteralValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| CodeBlock INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| Logical INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| SelfValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| Array INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| ArrayAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| Hash INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| AliasVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| AliasExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| MacroVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| MacroExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| Variable INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| VariableAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| PareExpList INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| FunCall INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| IfInline INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
| ObjectData INASSIGN Expression { HB_MACRO_IFENABLED( $$, hb_compExprAssign( $1, $3, HB_COMP_PARAM ), HB_SM_HARBOUR ); }
|
||||
| ObjectMethod INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
ExprAssign : LeftExpression INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprPlusEq : LeftExpression PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprPlusEq : LeftExpression PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprMinusEq : LeftExpression MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprMinusEq : LeftExpression MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprMultEq : LeftExpression MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprMultEq : LeftExpression MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprDivEq : LeftExpression DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprDivEq : LeftExpression DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprModEq : LeftExpression MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprModEq : LeftExpression MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprExpEq : LeftExpression EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
ExprExpEq : LeftExpression EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); }
|
||||
;
|
||||
|
||||
ExprOperEq : ExprPlusEq
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2498,20 +2498,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
|
||||
case HB_P_MACROPUSHREF:
|
||||
{
|
||||
PHB_ITEM pMacro = hb_stackItemFromTop( -1 );
|
||||
PHB_SYMB pSym;
|
||||
/* compile into a symbol name (used in function calls) */
|
||||
hb_macroPushSymbol( pMacro );
|
||||
/* NOTE: pMacro string is replaced with a symbol.
|
||||
* Symbol is created if it doesn't exist.
|
||||
*/
|
||||
if( hb_stackGetActionRequest() == 0 )
|
||||
{
|
||||
pSym = pMacro->item.asSymbol.value;
|
||||
/* NOTE: pMacro item of symbol type is replaced with
|
||||
* the reference
|
||||
*/
|
||||
hb_memvarGetRefer( pMacro, pSym );
|
||||
}
|
||||
hb_macroPushReference( pMacro );
|
||||
pCode++;
|
||||
}
|
||||
break;
|
||||
@@ -10924,9 +10911,7 @@ BOOL hb_xvmMacroPushRef( void )
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_xvmMacroPushRef()"));
|
||||
|
||||
pMacro = hb_stackItemFromTop( -1 );
|
||||
hb_macroPushSymbol( pMacro );
|
||||
if( hb_stackGetActionRequest() == 0 )
|
||||
hb_memvarGetRefer( pMacro, pMacro->item.asSymbol.value );
|
||||
hb_macroPushReference( pMacro );
|
||||
|
||||
HB_XVM_RETURN
|
||||
}
|
||||
|
||||
@@ -535,6 +535,44 @@ void hb_macroSetValue( HB_ITEM_PTR pItem, BYTE flags )
|
||||
}
|
||||
}
|
||||
|
||||
/* NOTE:
|
||||
* This will be called when macro variable or macro expression is
|
||||
* passed by reference or used in optimized left side of the <op>=
|
||||
* expression or as argument of ++ or -- operation
|
||||
*/
|
||||
void hb_macroPushReference( HB_ITEM_PTR pItem )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_macroPushReference(%p)", pItem));
|
||||
|
||||
if( hb_macroCheckParam( pItem ) )
|
||||
{
|
||||
HB_MACRO struMacro;
|
||||
int iStatus;
|
||||
|
||||
struMacro.mode = HB_MODE_MACRO;
|
||||
struMacro.supported = HB_SM_SHORTCUTS | HB_SM_HARBOUR | HB_SM_ARRSTR;
|
||||
struMacro.Flags = HB_MACRO_GEN_PUSH | HB_MACRO_GEN_REFER;
|
||||
struMacro.uiNameLen = HB_SYMBOL_NAME_LEN;
|
||||
struMacro.status = HB_MACRO_CONT;
|
||||
struMacro.string = pItem->item.asString.value;
|
||||
struMacro.length = pItem->item.asString.length;
|
||||
|
||||
iStatus = hb_macroParse( &struMacro );
|
||||
|
||||
if( iStatus == HB_MACRO_OK && ( struMacro.status & HB_MACRO_CONT ) )
|
||||
{
|
||||
hb_stackPop(); /* remove compiled string */
|
||||
hb_macroRun( &struMacro );
|
||||
}
|
||||
else
|
||||
hb_macroSyntaxError( &struMacro );
|
||||
|
||||
hb_macroDelete( &struMacro );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compile and run:
|
||||
* &alias->var or
|
||||
|
||||
@@ -41,3 +41,5 @@ LIBS=\
|
||||
hbcommon \
|
||||
|
||||
include $(TOP)$(ROOT)config/bin.cf
|
||||
|
||||
HB_USER_PRGFLAGS += -l-
|
||||
|
||||
Reference in New Issue
Block a user