From 2a91e7a436def3f62adbe071e8deafe1c7f69d48 Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Fri, 29 Dec 2000 08:46:24 +0000 Subject: [PATCH] 2000-12-28 20:50 UTC+0800 Ron Pinkas * source/vm/eval.c * Minor formatting. * source/vm/hvm.c * Added derefferncing of Block Vars in hb_vmPushLocal() /* Ryszard can you please review this change. */ --- harbour/ChangeLog | 8 ++++++++ harbour/source/vm/eval.c | 7 ++++++- harbour/source/vm/hvm.c | 24 ++++++++++++++++-------- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6ddae68569..d474a34cec 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,11 @@ +2000-12-28 20:50 UTC+0800 Ron Pinkas + * source/vm/eval.c + * Minor formatting. + + * source/vm/hvm.c + * Added derefferncing of Block Vars in hb_vmPushLocal() + /* Ryszard can you please review this change. */ + 2000-12-29 9:18 GMT+3 Alexander Kresin * utils/hbpp/hbpp.c * Now it creates exactly the same .ppo as Harbour, without extra empty diff --git a/harbour/source/vm/eval.c b/harbour/source/vm/eval.c index fb43ef330a..25dc61ffc9 100644 --- a/harbour/source/vm/eval.c +++ b/harbour/source/vm/eval.c @@ -55,10 +55,15 @@ HB_FUNC( EVAL ) * hb_param() is dereferencing the passed parameters */ for( uiParam = 2; uiParam <= uiPCount; uiParam++ ) - hb_vmPush( hb_stackItemFromBase( uiParam ) ); + { + hb_vmPush( hb_stackItemFromBase( uiParam ) ); + } + hb_vmDo( uiPCount - 1 ); } else + { hb_errRT_BASE_SubstR( EG_NOMETHOD, 1004, NULL, "EVAL" ); + } } diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 46d9992fb1..b01e40c274 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -2789,7 +2789,7 @@ void hb_vmDo( USHORT uiParams ) HB_TRACE(HB_TR_DEBUG, ("hb_vmDo(%hu)", uiParams)); - pItem = hb_stackNewFrame( &sStackState, uiParams ); + pItem = hb_stackNewFrame( &sStackState, uiParams ); pSym = pItem->item.asSymbol.value; pSelf = hb_stackSelfItem(); /* NIL, OBJECT or BLOCK */ bDebugPrevState = s_bDebugging; @@ -2924,6 +2924,7 @@ static HARBOUR hb_vmDoBlock( void ) /* Check for valid count of parameters */ iParam = pBlock->item.asBlock.paramcnt - hb_pcount(); + /* add missing parameters */ while( iParam-- > 0 ) hb_vmPushNil(); @@ -3477,24 +3478,31 @@ static void hb_vmPushAliasedVar( PHB_SYMB pSym ) static void hb_vmPushLocal( SHORT iLocal ) { + PHB_ITEM pLocal; + HB_TRACE(HB_TR_DEBUG, ("hb_vmPushLocal(%hd)", iLocal)); if( iLocal >= 0 ) { - PHB_ITEM pLocal; - /* local variable or local parameter */ pLocal = hb_stackItemFromBase( iLocal ); - if( HB_IS_BYREF( pLocal ) ) - hb_itemCopy( ( hb_stackTopItem() ), hb_itemUnRef( pLocal ) ); - else - hb_itemCopy( ( hb_stackTopItem() ), pLocal ); } else + { /* local variable referenced in a codeblock * hb_stackSelfItem() points to a codeblock that is currently evaluated */ - hb_itemCopy( ( hb_stackTopItem() ), hb_codeblockGetVar( hb_stackSelfItem(), ( LONG ) iLocal ) ); + pLocal = hb_codeblockGetVar( hb_stackSelfItem(), ( LONG ) iLocal ); + } + + if( HB_IS_BYREF( pLocal ) ) + { + hb_itemCopy( ( hb_stackTopItem() ), hb_itemUnRef( pLocal ) ); + } + else + { + hb_itemCopy( ( hb_stackTopItem() ), pLocal ); + } hb_stackPush(); }