From baf6469d63f08a1d321d6a58450dd6b65d1335c4 Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Thu, 22 Jun 2000 10:38:30 +0000 Subject: [PATCH] 2000-06-22 03:30 UTC-0800 Ron Pinkas * include/hbclass.ch ! Uncommented #xtranslate that was not pre-processing correctly, before recent fixes to ppcore.c and now works correctly. * source/compiler/harbour.c ! Fixed hb_compLinePush() to generate correct Run-Time Line Numbers. * source/pp/ppcomp.c - Removed one // comment. * source/pp/ppcore.c * Increased MAX_EXP to 2048 as requested by Brian Hays. --- harbour/ChangeLog | 13 +++++++ harbour/include/hbclass.ch | 3 +- harbour/source/compiler/harbour.c | 56 ++++++++++++++++++++++++++----- harbour/source/pp/ppcomp.c | 5 ++- harbour/source/pp/ppcore.c | 2 +- 5 files changed, 67 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f437548c4e..a238dfe72c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,16 @@ +2000-06-22 03:30 UTC-0800 Ron Pinkas + * include/hbclass.ch + ! Uncommented #xtranslate that was not pre-processing correctly, before recent fixes to ppcore.c and now works correctly. + + * source/compiler/harbour.c + ! Fixed hb_compLinePush() to generate correct Run-Time Line Numbers. + + * source/pp/ppcomp.c + - Removed one // comment. + + * source/pp/ppcore.c + * Increased MAX_EXP to 2048 as requested by Brian Hays. + 2000-06-21 21:35 UTC-0800 Ron Pinkas * source/pp/ppcore.c ! getExpReal() Fixed silly typo introduced this morning in previous fix, that broke the PP. diff --git a/harbour/include/hbclass.ch b/harbour/include/hbclass.ch index 376d9aa7c0..cf2ce7dd8a 100644 --- a/harbour/include/hbclass.ch +++ b/harbour/include/hbclass.ch @@ -99,8 +99,7 @@ #xtranslate := { [] } => := ():New(

) #xtranslate = { [] } => = ():New(

) -// This rule is generating preprocess matching errors. -// #xtranslate , { [] } => , ():New(

) +#xtranslate , { [] } => , ():New(

) #xtranslate EXPORTED: => nScope := HB_OO_CLSTP_EXPORTED #xtranslate VISIBLE: => nScope := HB_OO_CLSTP_EXPORTED diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index c76cc4c4bc..1ab97049e1 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -89,7 +89,7 @@ PCOMCLASS hb_comp_pLastClass; char * hb_comp_szFromClass; PCOMDECLARED hb_comp_pLastMethod; -int hb_comp_iLine; /* currently processed line number */ +int hb_comp_iLine; /* currently processed line number (globaly) */ PFUNCTION hb_comp_pInitFunc; PHB_FNAME hb_comp_pFileName = NULL; @@ -1933,17 +1933,57 @@ void hb_compLinePush( void ) /* generates the pcode with the currently compiled { if( hb_comp_bLineNumbers && ! hb_comp_bDontGenLineNum ) { - if( ( ( hb_comp_functions.pLast->lPCodePos - hb_comp_ulLastLinePos ) > 3 ) || hb_comp_bDebugInfo ) + int iLine = hb_comp_iLine; + + if( hb_comp_files.iFiles == 1 ) { - hb_comp_ulLastLinePos = hb_comp_functions.pLast->lPCodePos; - hb_compGenPCode3( HB_P_LINE, HB_LOBYTE( hb_comp_iLine ), HB_HIBYTE( hb_comp_iLine ), ( BOOL ) 0 ); + iLine = hb_comp_files.pLast->iLine ; } else { - hb_comp_functions.pLast->pCode[ hb_comp_ulLastLinePos +1 ] = HB_LOBYTE( hb_comp_iLine ); - hb_comp_functions.pLast->pCode[ hb_comp_ulLastLinePos +2 ] = HB_HIBYTE( hb_comp_iLine ); + PFILE tmpFile = hb_comp_files.pLast; + while( tmpFile->pPrev ) + { + tmpFile = tmpFile->pPrev; + } + if( tmpFile ) + { + iLine = tmpFile->iLine; + } + } + + if( yytext[0] == '\n' ) + { + if( hb_pp_nEmptyStrings ) + { + iLine -= ( hb_pp_nEmptyStrings + 2 ); + } + else + { + iLine--; + } + } + else + { + iLine--; + } + + #if 0 + printf( "\nLine: %i Empty: %i >%s<\n", iLine, hb_pp_nEmptyStrings, yytext ); + #endif + + if( ( ( hb_comp_functions.pLast->lPCodePos - hb_comp_ulLastLinePos ) > 3 ) || hb_comp_bDebugInfo ) + { + hb_comp_ulLastLinePos = hb_comp_functions.pLast->lPCodePos; + hb_compGenPCode3( HB_P_LINE, HB_LOBYTE( iLine ), HB_HIBYTE( iLine ), ( BOOL ) 0 ); + } + else + { + hb_comp_functions.pLast->pCode[ hb_comp_ulLastLinePos +1 ] = HB_LOBYTE( iLine ); + hb_comp_functions.pLast->pCode[ hb_comp_ulLastLinePos +2 ] = HB_HIBYTE( iLine ); } } + if( hb_comp_functions.pLast->bFlags & FUN_BREAK_CODE ) { /* previous line contained RETURN/BREAK/LOOP/EXIT statement */ @@ -3769,9 +3809,9 @@ int hb_compAutoOpen( char * szPrg, BOOL * pbSkipGen ) { int i = hb_comp_iExitLevel ; BOOL b = hb_comp_bAnyWarning; - + yyparse(); - + hb_comp_iExitLevel = ( i > hb_comp_iExitLevel ? i : hb_comp_iExitLevel ); hb_comp_bAnyWarning = ( b ? b : hb_comp_bAnyWarning ); } diff --git a/harbour/source/pp/ppcomp.c b/harbour/source/pp/ppcomp.c index 31d4c9c90d..c646aec22b 100644 --- a/harbour/source/pp/ppcomp.c +++ b/harbour/source/pp/ppcomp.c @@ -229,7 +229,10 @@ int hb_pp_Internal( FILE * handl_o, char * sOut ) *( sOut + lens ) = '\0'; hb_comp_files.pLast->iLine += hb_pp_nEmptyStrings; - //hb_pp_nEmptyStrings = 0; + + #if 0 + printf( "Line: %i >%s<\n", hb_comp_files.pLast->iLine, sOut ); + #endif if( handl_o ) hb_pp_WrStr( handl_o, sOut ); diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 9c9c8d6cbb..ce1e385a48 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -133,7 +133,7 @@ static BOOL s_bTracePragma = FALSE; #define ISNAME( c ) ( isalnum( ( int ) c ) || ( c ) == '_' || ( c ) > 0x7E ) #define MAX_NAME 255 -#define MAX_EXP 1024 +#define MAX_EXP 2048 #define PATTERN_SIZE 2048 #define STATE_INIT 0