From d6b99e88342e8f8fc3361976b3aa4b5078d9e26d Mon Sep 17 00:00:00 2001 From: Antonio Linares Date: Fri, 25 Jan 2002 13:35:11 +0000 Subject: [PATCH] proper generation (placement) of HB_P_SEND opcode --- harbour/include/hbexprc.c | 59 ++++++++++++++------------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/harbour/include/hbexprc.c b/harbour/include/hbexprc.c index d1c03110b7..f3517e072b 100644 --- a/harbour/include/hbexprc.c +++ b/harbour/include/hbexprc.c @@ -95,24 +95,16 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) { HB_EXPR_PTR pObj = pSelf->value.asOperator.pLeft; + /* Push _message for the later assignment. */ + HB_EXPR_PCODE1( hb_compGenMessageData, pObj->value.asMessage.szMessage ); /* Push object */ HB_EXPR_USE( pObj->value.asMessage.pObject, HB_EA_PUSH_PCODE ); - /* Push _message for later use */ - HB_EXPR_PCODE1( hb_compGenMessageData, pObj->value.asMessage.szMessage ); /* Now push current value of variable */ -#ifdef HB_C52_STRICT + HB_EXPR_PCODE1( hb_compGenMessage, pObj->value.asMessage.szMessage ); /* push object */ HB_EXPR_USE( pObj->value.asMessage.pObject, HB_EA_PUSH_PCODE ); -#else - /* NOTE: this duplicate optimization requires that HB_P_MESSAGE - * reverts items on the stack ! - * duplicate object on the stack - */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); -#endif - /* now send the message */ - HB_EXPR_PCODE1( hb_compGenMessage, pObj->value.asMessage.szMessage ); + /* Do it. */ HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0, ( BOOL ) 1 ); /* NOTE: COMPATIBILITY ISSUE: @@ -179,21 +171,16 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) { HB_EXPR_PTR pObj = pSelf->value.asOperator.pLeft; + /* Push _message for the later assignment. */ + HB_EXPR_PCODE1( hb_compGenMessageData, pObj->value.asMessage.szMessage ); /* Push object */ HB_EXPR_USE( pObj->value.asMessage.pObject, HB_EA_PUSH_PCODE ); - /* Push _message for later use */ - HB_EXPR_PCODE1( hb_compGenMessageData, pObj->value.asMessage.szMessage ); /* Now push current value of variable */ -#ifdef HB_C52_STRICT - /* push object */ - HB_EXPR_USE( pObj->value.asMessage.pObject, HB_EA_PUSH_PCODE ); -#else - /* duplicate object on the stack */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); -#endif - /* now send the message */ HB_EXPR_PCODE1( hb_compGenMessage, pObj->value.asMessage.szMessage ); + /* Push object */ + HB_EXPR_USE( pObj->value.asMessage.pObject, HB_EA_PUSH_PCODE ); + /* Do it.*/ HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0, ( BOOL ) 1 ); /* push increment value */ @@ -201,9 +188,10 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) /* increase operation */ HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); - /* call pop message with one argument */ + /* Now do the assignment - call pop message with one argument */ HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1, ( BOOL ) 1 ); - /* pop the value from the stack */ + + /* pop the unneeded value from the stack */ HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); } else @@ -233,27 +221,22 @@ void hb_compExprPushPreOp( HB_EXPR_PTR pSelf, BYTE bOper ) { HB_EXPR_PTR pObj = pSelf->value.asOperator.pLeft; - /* Push object */ - HB_EXPR_USE( pObj->value.asMessage.pObject, HB_EA_PUSH_PCODE ); /* Push _message for later use */ HB_EXPR_PCODE1( hb_compGenMessageData, pObj->value.asMessage.szMessage ); + /* Push object */ + HB_EXPR_USE( pObj->value.asMessage.pObject, HB_EA_PUSH_PCODE ); /* Now push current value of variable */ -#ifdef HB_C52_STRICT - /* push object */ - HB_EXPR_USE( pObj->value.asMessage.pObject, HB_EA_PUSH_PCODE ); -#else - /* duplicate object on the stack */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); -#endif - /* now send the message */ HB_EXPR_PCODE1( hb_compGenMessage, pObj->value.asMessage.szMessage ); + /* Push object */ + HB_EXPR_USE( pObj->value.asMessage.pObject, HB_EA_PUSH_PCODE ); + /* Do it. */ HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0, ( BOOL ) 1 ); /* increase/decrease operation */ HB_EXPR_GENPCODE1( hb_compGenPCode1, bOper ); - /* call pop message with one argument - it leaves the value on the stack */ + /* Now, do the assignment - call pop message with one argument - it leaves the value on the stack */ HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1, ( BOOL ) 1 ); } else @@ -457,9 +440,9 @@ BOOL hb_compExprCheckMacroVar( char * szText ) if( bTextSubst ) { #if defined( HB_MACRO_SUPPORT ) - HB_SYMBOL_UNUSED( bMacroText ); + HB_SYMBOL_UNUSED( bMacroText ); return TRUE; /*there is no need to check all '&' occurences */ -#else +#else /* There is a valid character after '&' that can be used in * variable name - check if the whole variable name is valid * (local, static and field variable names are invalid because @@ -522,4 +505,4 @@ HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight, HB_SYMBOL_UNUSED( HB_MACRO_PARAM ); /* to suppress BCC warning */ return pLeft; } -#endif +#endif \ No newline at end of file