From 5b36bb57d080550869208b748a6332780b4e4ff5 Mon Sep 17 00:00:00 2001 From: Antonio Linares Date: Fri, 6 Aug 1999 17:53:29 +0000 Subject: [PATCH] *** empty log message *** --- harbour/source/compiler/harbour.y | 51 +++++++++++++++++++++++++------ harbour/source/vm/hvm.c | 12 ++++++++ 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 72b8c84928..81be84b6f6 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -1863,17 +1863,29 @@ void AddVar( char * szVarName ) { case VS_LOCAL: case VS_PARAMETER: - if( ! pFunc->pLocals ) - pFunc->pLocals = pVar; - else - { - pLastVar = pFunc->pLocals; - while( pLastVar->pNext ) - pLastVar = pLastVar->pNext; - pLastVar->pNext = pVar; + { WORD wLocal = 1; + + if( ! pFunc->pLocals ) + pFunc->pLocals = pVar; + else + { + pLastVar = pFunc->pLocals; + while( pLastVar->pNext ) + { + pLastVar = pLastVar->pNext; + wLocal++; + } + pLastVar->pNext = pVar; + } + if( iVarScope == VS_PARAMETER ) + ++functions.pLast->wParamCount; + if( _bDebugInfo ) + { + GenPCode3( HB_P_LOCALNAME, LOBYTE( wLocal ), HIBYTE( wLocal ) ); + GenPCodeN( szVarName, strlen( szVarName ) ); + GenPCode1( 0 ); + } } - if( iVarScope == VS_PARAMETER ) - ++functions.pLast->wParamCount; break; case VS_STATIC: @@ -2469,6 +2481,25 @@ void GenCCode( char *szFileName, char *szName ) /* generates the C languag lPCodePos += 3; break; + case HB_P_LOCALNAME: + fprintf( yyc, " HB_P_LOCALNAME, %i, %i,\t/* %s */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + ( char * ) pFunc->pCode + lPCodePos + 3 ); + lPCodePos += 3; + while( pFunc->pCode[ lPCodePos ] ) + { + chr = pFunc->pCode[ lPCodePos++ ]; + if( chr == '\'' || chr == '\\') + fprintf( yyc, " \'\\%c\',", chr ); + else + fprintf( yyc, " \'%c\',", chr ); + } + fprintf( yyc, " 0,\n" ); + lPCodePos++; + break; + break; + case HB_P_MESSAGE: { WORD wFixPos; diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index d31da41648..79eb24b25f 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -91,6 +91,7 @@ void Inc( void ); /* increment the latest numeric value on the st void Instring( void ); /* check whether string 1 is contained in string 2 */ void Less( void ); /* checks if the latest - 1 value is less than the latest, removes both and leaves result */ void LessEqual( void ); /* checks if the latest - 1 value is less than or equal the latest, removes both and leaves result */ +void LocalName( WORD wLocal, char * szLocalName ); /* locals and parameters index and name information for the debugger */ void Message( PHB_SYMB pSymMsg ); /* sends a message to an object */ void Minus( void ); /* substracts the latest two values on the stack, removes them and leaves the result */ void ModuleName( char * szModuleName ); /* PRG and function name information for the debugger */ @@ -425,6 +426,13 @@ void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ) w += 3; break; + case HB_P_LOCALNAME: + LocalName( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ), + ( char * ) pCode + w + 3 ); + w += 3; + while( pCode[ w++ ] ); + break; + case HB_P_MESSAGE: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); Message( pSymbols + wParams ); @@ -1240,6 +1248,10 @@ void LessEqual( void ) } } +void LocalName( WORD wLocal, char * szLocalName ) /* locals and parameters index and name information for the debugger */ +{ +} + void Message( PHB_SYMB pSymMsg ) /* sends a message to an object */ { hb_itemCopy( stack.pPos, stack.pPos - 1 ); /* moves the object forward */