diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1510bb369a..cb1ed0c011 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,12 @@ +19990825-13:30 GMT+2 Ryszard Glab + + *source/vm/hvm.c + * corrected alias handling in hb_vmAliasSwap() however we still need + to implement the function that will select an workarea using passed + string with an alias name + * if QUIT or BREAK is called in EXIT PROCEDURE then processing + of these procedures is stopped + 19990825-12:50 GMT+1 Victor Szel * source/rdd/dbcmd.c diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index fa0634a74d..62a729c072 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -822,7 +822,36 @@ static void hb_vmAliasSwap( void ) HB_ITEM_PTR pItem = stack.pPos -1; HB_ITEM_PTR pWorkArea = stack.pPos -2; - hb_rddSelectWorkAreaNumber( pWorkArea->item.asInteger.value ); + switch( pWorkArea->type & ~IT_BYREF ) + { + case IT_INTEGER: + /* Alias was used as integer value, for example: 4->field + * or it was saved on the stack using hb_vmAliasPush() + * or was evaluated from an expression, (nWorkArea)->field + */ + hb_rddSelectWorkAreaNumber( pWorkArea->item.asInteger.value ); + break; + + case IT_SYMBOL: + /* Alias was specified using alias identifier, for example: al->field + */ + hb_rddSelectWorkAreaNumber( pWorkArea->item.asSymbol.value->pDynSym->hArea ); + break; + + case IT_STRING: + /* Alias was evaluated from an expression, for example: (cVar)->field + */ + /* TODO: synchronize it with RDD API + hb_rddSelectWorkAreaAlias( pWorkArea->item.asString.value ); + */ + hb_itemClear( pWorkArea ); + break; + + default: + hb_itemClear( pWorkArea ); + hb_errRT_BASE( EG_BADALIAS, 1000, NULL, NULL ); + break; + } memcpy( pWorkArea, pItem, sizeof( HB_ITEM ) ); pItem->type =IT_NIL; hb_stackDec(); @@ -2400,6 +2429,10 @@ static void hb_vmDoExitFunctions( void ) hb_vmPushSymbol( pLastSymbols->pModuleSymbols + w ); hb_vmPushNil(); hb_vmDo( 0 ); + if( wActionRequest ) + /* QUIT or BREAK was issued - stop processing + */ + return; } } }