From aaefbf34666ee6b83c42fdba9b102f57e9b5c74f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 26 Jun 2012 22:23:35 +0000 Subject: [PATCH] 2012-06-27 00:22 UTC+0200 Viktor Szakats (harbour syenar.net) + examples/hbdoc/genbase.prg - examples/hbdoc/gentpl.prg * examples/hbdoc/genhtml.prg * examples/hbdoc/hbdoc.hbp * examples/hbdoc/hbdoc.prg * further cleanups --- harbour/ChangeLog | 8 ++++++++ .../hbdoc/{gentpl.prg => genbase.prg} | 4 ++-- harbour/examples/hbdoc/genhtml.prg | 6 ++++-- harbour/examples/hbdoc/hbdoc.hbp | 6 +++--- harbour/examples/hbdoc/hbdoc.prg | 20 +++++-------------- 5 files changed, 22 insertions(+), 22 deletions(-) rename harbour/examples/hbdoc/{gentpl.prg => genbase.prg} (97%) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 218706037f..f826542cbe 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2012-06-27 00:22 UTC+0200 Viktor Szakats (harbour syenar.net) + + examples/hbdoc/genbase.prg + - examples/hbdoc/gentpl.prg + * examples/hbdoc/genhtml.prg + * examples/hbdoc/hbdoc.hbp + * examples/hbdoc/hbdoc.prg + * further cleanups + 2012-06-27 00:09 UTC+0200 Viktor Szakats (harbour syenar.net) * examples/hbdoc/genhtml.prg * examples/hbdoc/gentpl.prg diff --git a/harbour/examples/hbdoc/gentpl.prg b/harbour/examples/hbdoc/genbase.prg similarity index 97% rename from harbour/examples/hbdoc/gentpl.prg rename to harbour/examples/hbdoc/genbase.prg index 3a2b76f394..4f6fcd872d 100644 --- a/harbour/examples/hbdoc/gentpl.prg +++ b/harbour/examples/hbdoc/genbase.prg @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * Document generator template class + * Document generator base class * * Copyright 2009 April White * www - http://harbour-project.org @@ -103,7 +103,7 @@ METHOD New( cFolder, cFilename, cTitle, cExtension, nType ) CLASS TPLGenerate ::nType := nType IF ! hb_DirExists( ::cFolder ) - OutStd( hb_eol(), "Creating folder " + ::cFolder ) + OutStd( hb_eol() + "Creating folder '" + ::cFolder + "'" ) hb_DirCreate( ::cFolder ) ENDIF diff --git a/harbour/examples/hbdoc/genhtml.prg b/harbour/examples/hbdoc/genhtml.prg index 07240b6cd6..65e8313bdb 100644 --- a/harbour/examples/hbdoc/genhtml.prg +++ b/harbour/examples/hbdoc/genhtml.prg @@ -276,9 +276,11 @@ METHOD Append( cText, cFormat ) CLASS GenerateHTML cResult := StrTran( cResult, Chr( aFormat[ idx ] ), "&" + aFormat[ idx + 1 ] + ";" ) NEXT - aFormat := Split( cFormat, "," ) + aFormat := hb_ATokens( cFormat, "," ) FOR idx := Len( aFormat ) TO 1 STEP -1 - cResult := "<" + aFormat[ idx ] + ">" + cResult + "" + IF ! Empty( aFormat[ idx ] ) + cResult := "<" + aFormat[ idx ] + ">" + cResult + "" + ENDIF NEXT DO WHILE Right( cResult, Len( hb_eol() ) ) == hb_eol() diff --git a/harbour/examples/hbdoc/hbdoc.hbp b/harbour/examples/hbdoc/hbdoc.hbp index 5305187422..a1289b8ec5 100644 --- a/harbour/examples/hbdoc/hbdoc.hbp +++ b/harbour/examples/hbdoc/hbdoc.hbp @@ -11,10 +11,10 @@ -gtcgi hbdoc.prg +tmplates.prg + +genbase.prg -gentpl.prg gentxt.prg genhtml.prg genxml.prg - -tmplates.prg diff --git a/harbour/examples/hbdoc/hbdoc.prg b/harbour/examples/hbdoc/hbdoc.prg index d912708f18..e121ff336c 100644 --- a/harbour/examples/hbdoc/hbdoc.prg +++ b/harbour/examples/hbdoc/hbdoc.prg @@ -1008,26 +1008,16 @@ FUNCTION Parse(cVar, xDelimiter) RETURN cResult -FUNCTION Split(cVar, xDelimiter) - LOCAL aResult := {} - LOCAL clVar := cVar - - DO WHILE Len(clVar) > 0 - AAdd(aResult, Parse( @clVar, xDelimiter ) ) - ENDDO - - RETURN aResult - FUNCTION Join(aVar, cDelimiter) LOCAL cResult := "" - AEval( aVar, {|c,n| cResult += iif( n > 1, cDelimiter, "" ) + c } ) + AEval( aVar, {| c, n | cResult += iif( n > 1, cDelimiter, "" ) + c } ) RETURN cResult STATIC PROCEDURE AddErrorCondition( cFile, cMessage, nLine ) IF p_hsSwitches[ "immediate-errors" ] - qout( cFile + ":" + HB_NTOS( nLine ) + ": " + cMessage ) + OutStd( cFile + ":" + HB_NTOS( nLine ) + ": " + cMessage + hb_eol() ) ENDIF RETURN @@ -1040,10 +1030,10 @@ FUNCTION Indent( cText, nLeftMargin, nWidth, lRaw ) hb_default( @lRaw, .F. ) IF nWidth == 0 .or. lRaw - aText := Split( cText, hb_eol() ) + aText := hb_ATokens( cText, hb_eol() ) idx := 99999 - AEval( aText, {|c| iif( Empty(c), , idx := Min( idx, Len( c ) - Len( LTrim( c ) ) ) ) } ) - AEval( aText, {|c,n| aText[ n ] := Space( nLeftMargin ) + SubStr( c, idx + 1 ) } ) + AEval( aText, {| c | iif( Empty( c ), , idx := Min( idx, Len( c ) - Len( LTrim( c ) ) ) ) } ) + AEval( aText, {| c, n | aText[ n ] := Space( nLeftMargin ) + SubStr( c, idx + 1 ) } ) cResult := Join( aText, hb_eol() ) + hb_eol() + hb_eol() ELSE DO WHILE Len( cText ) > 0