From 8f30efeed58e1ae1bbe9c8fc9fe738e7452fb2b3 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Wed, 28 Jul 1999 11:06:17 +0000 Subject: [PATCH] Updating preprocessor files --- harbour/ChangeLog | 4 ++++ harbour/source/hbpp/hbpp.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a275c89750..3df198b4a5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,7 @@ +19990728-14:44 Alexander Kresin + * source\hbpp\hbpp.c + * Bug, appeared after last change, fixed + 19990728-12:30 CET Eddie Runia * source/runner/runner.c Symbols with both INIT and EXIT raised are not EXIT symbols. diff --git a/harbour/source/hbpp/hbpp.c b/harbour/source/hbpp/hbpp.c index 064f9f445c..320cc0a91a 100644 --- a/harbour/source/hbpp/hbpp.c +++ b/harbour/source/hbpp/hbpp.c @@ -582,13 +582,13 @@ int ParseExpression( char* sLine, char* sOutLine ) if ( ipos > 0 ) { *(ptri+lens) = ';'; - lens += strolen( ptri+ipos ); + lens += strolen( ptri+ipos ) + 1; } - pp_Stuff ( sOutLine, ptri, ptro - sOutLine + 1, (ipos)? ipos-1:lens, lens ); - if ( ipos > 0 ) + pp_Stuff ( sOutLine, ptri, ptro - sOutLine, (ipos)? ipos-1:lens, lens ); + if ( ipos > 0 ) { - ipos = strolen( ptri ); - *(ptri+ipos) = '\0'; + ipos = ptro - sOutLine + 1; + *(ptri + ipos - 1) = '\0'; } } else @@ -795,9 +795,9 @@ int WorkTranslate ( char* sToken, char* ptri, char* ptro, int ndef, int *lens ) groupchar = '@'; rez = CommandStuff ( ptrmp, ptri, ptro, &lenres, FALSE ); - if ( rez < 0 ) ndef = TraSearch(sToken,ndef-1); + if ( rez < 0 && ndef > 0 ) ndef = TraSearch(sToken,ndef-1); } - while ( rez < 0 && ndef >= 0 ); + while ( rez < 0 && ndef > 0 ); *(ptro+lenres) = '\0'; if ( rez >= 0 ) @@ -1479,11 +1479,11 @@ int md_strAt(char *szSub, int lSubLen, char *szText, int checkPrth) kolPrth++; else if ( *(szText+lPos) == ')' ) kolPrth--; - if( checkPrth && ( (kolPrth > 0) || (kolPrth == 0 && *(szText+lPos) == ')') ) ) + if( !lSubPos && checkPrth && ( (kolPrth > 1) || + (kolPrth == 1 && *(szText+lPos) != '(') || (kolPrth == 0 && *(szText+lPos) == ')')) ) { - lPos++; - lSubPos = 0; - continue; + lPos++; + continue; } if( toupper(*(szText + lPos)) == toupper(*(szSub + lSubPos)) )