From d04e918b68f5c3271c0207a23bdaf23b8d482576 Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Sun, 30 Jan 2000 12:42:11 +0000 Subject: [PATCH] ChangeLog 20000130-13:55 GMT+1 --- harbour/ChangeLog | 10 ++++++++++ harbour/source/compiler/harbour.l | 2 +- harbour/source/vm/hvm.c | 12 ++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 18199da9c7..e554d9496a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,13 @@ +20000130-13:55 GMT+1 Ryszard Glab + + *source/compiler/harbour.l + * fixed support for macro variables used in FOR statement + + *source/vm/hvm.c + * private variables created during a macro evaluation are not + released after a macro evaluation. They have the function/procedure + scope. + 20000129-19:15 GMT+1 Victor Szel * bin/bld_tpl.* ! Added macro lib. diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index c79dbbb45f..fb967ec27c 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -596,7 +596,7 @@ Separator {SpaceTab} /* ************************************************************************ */ %} "for" { BEGIN FOR_; } -{Separator}+[_a-zA-Z] { /* an identifier after the FOR */ +{Separator}+[&_a-zA-Z] { /* an identifier or a macro after the FOR */ unput( yytext[ yyleng-1 ] ); if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0; if( hb_comp_iState == LOOKUP ) diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index ccc606d994..13bc9fa367 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -343,7 +343,14 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols ) HB_TRACE(HB_TR_DEBUG, ("hb_vmExecute(%p, %p)", pCode, pSymbols)); - ulPrivateBase = hb_memvarGetPrivatesBase(); + /* NOTE: if pSymbols == NULL then hb_vmExecute is called from macro + * evaluation. In this case all PRIVATE variables created during + * macro evaluation belong to a function/procedure where macro + * compiler was called. + */ + if( pSymbols ) + ulPrivateBase = hb_memvarGetPrivatesBase(); + while( ( bCode = pCode[ w ] ) != HB_P_ENDPROC ) { switch( bCode ) @@ -1150,7 +1157,8 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols ) } } } - hb_memvarSetPrivatesBase( ulPrivateBase ); + if( pSymbols ) + hb_memvarSetPrivatesBase( ulPrivateBase ); } /* ------------------------------- */