From b60bc911483631a71979ae30b79a13062110d543 Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Thu, 19 Oct 2000 17:34:50 +0000 Subject: [PATCH] ! Corrected bug with nested #if... ! Corrected handling of EOF. /* 2 minor bugs in PP of fwh/samples/fwbrow still pending. */ --- harbour/contrib/dot/pp.prg | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/harbour/contrib/dot/pp.prg b/harbour/contrib/dot/pp.prg index a7e09aaa28..24384a89b2 100644 --- a/harbour/contrib/dot/pp.prg +++ b/harbour/contrib/dot/pp.prg @@ -601,7 +601,10 @@ FUNCTION ProcessFile( sSource, sSwitch ) FClose( hSource ) - sLine += SubStr( sBuffer, nPosition ) + //? sSource, nPosition, nMaxPos, nLen, SubStr( sLine, nPosition, 40 ) + //WAIT + + sLine += SubStr( sBuffer, nPosition, Max( 0, ( nMaxPos + 2 ) - nPosition ) ) sLine := StrTran( sLine, Chr(09), ' ' ) sLine := RTrim( sLine ) sLine := StrTran( sLine, Chr(10), '' ) @@ -706,7 +709,28 @@ FUNCTION ProcessLine( sLine, aDefined, aTranslated, aCommanded, nLine, sSource ) LOOP ENDIF - IF sDirective == "ELSE" + IF sDirective == Left( "IFDEF", nLen ) .AND. nIfDef > 0 .AND. ! abIfDef[ nIfDef ] + + nIfDef++ + aSize( abIfDef, nIfDef ) + abIfDef[ nIfDef ] := .F. + sLine := '' + LOOP + + ELSEIF sDirective == Left( "IFNDEF", nLen ) .AND. nIfDef > 0 .AND. ! abIfDef[ nIfDef ] + + nIfDef++ + aSize( abIfDef, nIfDef ) + abIfDef[ nIfDef ] := .F. + sLine := '' + LOOP + + ELSEIF sDirective == "ELSE" .AND. nIfDef > 0 .AND. ! abIfDef[ nIfDef ] + + sLine := '' + LOOP + + ELSEIF sDirective == "ELSE" abIfDef[ nIfDef ] := ! abIfDef[ nIfDef ] sLine := ''