diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5fec4d6a8b..408277e709 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,10 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-06-03 11:25 UTC+0300 Alexander Kresin + * utils/hbformat/hbformat.prg + ! Bug fixed. + 2009-06-03 08:17 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * include/hbextern.ch * source/rtl/idlex.c diff --git a/harbour/utils/hbformat/hbformat.prg b/harbour/utils/hbformat/hbformat.prg index a772706a2c..4475e23a04 100644 --- a/harbour/utils/hbformat/hbformat.prg +++ b/harbour/utils/hbformat/hbformat.prg @@ -106,10 +106,15 @@ FUNCTION MAIN( ... ) STATIC FUNCTION FCallBack( aFile, nItem ) + STATIC nIter := 0 LOCAL n := Int( Len( aFile ) / 40 ) - IF nItem % n == 1 + IF nItem == 1 + nIter := 0 + ENDIF + IF nItem % n == 1 .AND. nIter < 41 ?? "." + nIter ++ ENDIF RETURN Nil @@ -347,7 +352,7 @@ METHOD Reformat( aFile ) CLASS CODEFORMAT LOCAL i, iDelta := 0, nLen := Len( aFile ), cToken1, cToken2, nLenToken, nPos LOCAL nPosSep, cLine, cLineAll, nLineSegment LOCAL nContrState, nIndent, nDeep := 0, aDeep := {} - LOCAL lPragmaDump := .F. , lClass := .F. , lComment := .F. , nPosComment := 0, nPosCommPrev + LOCAL lPragmaDump := .F. , lClass := .F. , lComment := .F. , nPosComment := 0, lContinue := .F. LOCAL nStatePrev, nState := 0 PRIVATE cFunctions := Upper( ::cFunctions ) @@ -359,7 +364,6 @@ METHOD Reformat( aFile ) CLASS CODEFORMAT IF ::bCallBack != Nil Eval( ::bCallBack, aFile, i ) ENDIF - nPosCommPrev := nPosComment nPosComment := 0 IF ::lIndent aFile[i] := StrTran( RTrim( aFile[i] ), Chr( 9 ), " " ) @@ -424,7 +428,7 @@ METHOD Reformat( aFile ) CLASS CODEFORMAT ENDIF IF !lPragmaDump .AND. ::lIndent .AND. ( !lComment .OR. nPosComment > 1 ) aFile[i] := cLineAll - IF i == 1 .OR. Right( aFile[i-1], 1 ) != ";" .OR. nPosCommPrev != 0 + IF !lContinue nPosSep := 1 nLineSegment := 1 DO WHILE .T. @@ -566,6 +570,12 @@ METHOD Reformat( aFile ) CLASS CODEFORMAT // This line is a continuation of previous aFile[i] := Space( ::nIndLeft + ::nIndNext * nDeep + ::nIndCont ) + ::FormatLine( aFile[i], .T. ) ENDIF + IF ( nPosComment > 0 .AND. Right(Trim(Left( aFile[i],nPosComment-1 )),1) == ';' ) ; + .OR. ( nPosComment == 0 .AND. Right( aFile[i],1 ) == ';' ) + lContinue := .T. + ELSE + lContinue := .F. + ENDIF ELSEIF !lPragmaDump aFile[i] := ::FormatLine( aFile[i] ) ENDIF