diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a941c0b36a..c17be67e94 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,24 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-15 09:21 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/hbmk2_qt.hbs + * Whitespace. + + * include/harbour.hbx + * src/rtl/hbdoc.prg + * tests/stripdoc.hbs + * Added __HBDOC_FILTEROUT( ) -> internal + function to strip all NG doc content from a file and + return the stripped file. + + * contrib/hbide/idedocwriter.prg + + Use core __HBDOC_TOSOURCE() to generate NG doc source. + (just build tested) + ; TOFIX: idedocwriter.prg and ideharbourhelp.prg + still makes direct reference to NG doc physical + format. Pls change these to use __HBDOC_* functions. + 2011-02-14 15:55 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/idemain.prg * contrib/hbide/idemisc.prg @@ -24,9 +42,9 @@ ( As per __HBDYNLOAD__RDDADS__ ). * contrib/hbide/ideharbourhelp.prg + Implemented: to honor .hbd files. - .hbd files are looked into Harbour's root path and if - found, are used by "Documentation Viewer" other - standard .txt files are processed in /doc OR /doc/en + .hbd files are looked into Harbour's root path and if + found, are used by "Documentation Viewer" other + standard .txt files are processed in /doc OR /doc/en folders anywhere under the root folder. HBGD seems to be missing from .hbd compilation. diff --git a/harbour/contrib/hbide/idedocwriter.prg b/harbour/contrib/hbide/idedocwriter.prg index 2cc78093d6..2c234217c0 100644 --- a/harbour/contrib/hbide/idedocwriter.prg +++ b/harbour/contrib/hbide/idedocwriter.prg @@ -680,69 +680,54 @@ METHOD IdeDocWriter:saveInFunction() METHOD IdeDocWriter:buildDocument() LOCAL s - LOCAL txt_:= {} LOCAL nIndex := ::oUI:q_comboTemplate:currentIndex() - aadd( txt_, "/* $DOC$" ) - aadd( txt_, " * $TEMPLATE$" ) - aadd( txt_, " * " + iif( nIndex == 2, "Class", iif( nIndex == 1, "Procedure", "Function" ) ) ) + LOCAL hEntry := { => } + + hb_HKeepOrder( hEntry, .T. ) + + hEntry[ "TEMPLATE" ] := iif( nIndex == 2, "Class", iif( nIndex == 1, "Procedure", "Function" ) ) IF !empty( s := ::oUI:q_editName:text() ) - aadd( txt_, " * $NAME$" ) - aadd( txt_, " * " + s ) + hEntry[ "NAME" ] := s ENDIF - IF !empty( s := ::oUI:q_editOneLiner:text() ) - aadd( txt_, " * $ONELINER$" ) - aadd( txt_, " * " + s ) - ENDIF - IF !empty( s := ::oUI:q_editSyntax:text() ) - aadd( txt_, " * $SYNTAX$" ) - aadd( txt_, " * " + s ) - ENDIF - IF !empty( s := ::oUI:q_editReturns:text() ) - aadd( txt_, " * $RETURNS$" ) - aadd( txt_, " * " + s ) - ENDIF - - hbide_populateParam( @txt_, " * $ARGUMENTS$" , ::oUI:q_plainArgs:toPlainText() ) - hbide_populateParam( @txt_, " * $DESCRIPTION$", ::oUI:q_plainDesc:toPlainText() ) - hbide_populateParam( @txt_, " * $EXAMPLES$" , ::oUI:q_plainExamples:toPlainText() ) - hbide_populateParam( @txt_, " * $TESTS$" , ::oUI:q_plainTests:toPlainText() ) - IF !empty( s := ::oUI:q_editCategory:text() ) - aadd( txt_, " * $CATEGORY$" ) - aadd( txt_, " * " + s ) + hEntry[ "CATEGORY" ] := s ENDIF IF !empty( s := ::oUI:q_editSubCategory:text() ) - aadd( txt_, " * $SUBCATEGORY$" ) - aadd( txt_, " * " + s ) - ENDIF - IF !empty( s := ::oUI:q_editVersion:text() ) - aadd( txt_, " * $VERSION$" ) - aadd( txt_, " * " + s ) - ENDIF - IF !empty( s := ::oUI:q_editStatus:text() ) - aadd( txt_, " * $STATUS$" ) - aadd( txt_, " * " + s ) - ENDIF - IF !empty( s := ::oUI:q_editCompliance:text() ) - aadd( txt_, " * $PLATFORMS$" ) - aadd( txt_, " * " + s ) + hEntry[ "SUBCATEGORY" ] := s ENDIF IF !empty( s := ::oUI:q_editExtLink:text() ) - aadd( txt_, " * $EXTERNALLINK$" ) - aadd( txt_, " * " + s ) + hEntry[ "EXTERNALLINK" ] := s ENDIF - IF !empty( s := ::oUI:q_editSeeAlso:text() ) - aadd( txt_, " * $SEEALSO$" ) - aadd( txt_, " * " + s ) + IF !empty( s := ::oUI:q_editOneLiner:text() ) + hEntry[ "ONELINER" ] := s + ENDIF + IF !empty( s := ::oUI:q_editSyntax:text() ) + hEntry[ "SYNTAX" ] := s + ENDIF + hEntry[ "ARGUMENTS" ] := ::oUI:q_plainArgs:toPlainText() + IF !empty( s := ::oUI:q_editReturns:text() ) + hEntry[ "RETURNS" ] := s + ENDIF + hEntry[ "DESCRIPTION" ] := ::oUI:q_plainDesc:toPlainText() + hEntry[ "EXAMPLES" ] := ::oUI:q_plainExamples:toPlainText() + hEntry[ "TESTS" ] := ::oUI:q_plainTests:toPlainText() + IF !empty( s := ::oUI:q_editStatus:text() ) + hEntry[ "STATUS" ] := s + ENDIF + IF !empty( s := ::oUI:q_editCompliance:text() ) + hEntry[ "PLATFORMS" ] := s + ENDIF + IF !empty( s := ::oUI:q_editVersion:text() ) + hEntry[ "VERSION" ] := s ENDIF IF !empty( s := ::oUI:q_editFiles:text() ) - aadd( txt_, " * $FILES$" ) - aadd( txt_, " * " + s ) + hEntry[ "FILES" ] := s + ENDIF + IF !empty( s := ::oUI:q_editSeeAlso:text() ) + hEntry[ "SEEALSO" ] += s ENDIF - aadd( txt_, " * $END$" ) - aadd( txt_, "*/" ) - RETURN txt_ + RETURN __hbdoc_ToSource( { hEntry } ) /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/hbmk2_qt.hbs b/harbour/contrib/hbqt/hbmk2_qt.hbs index 61182c517a..10a0bf92fe 100644 --- a/harbour/contrib/hbqt/hbmk2_qt.hbs +++ b/harbour/contrib/hbqt/hbmk2_qt.hbs @@ -2115,25 +2115,25 @@ METHOD HbQtSource:buildDOC() ENDIF NEXT ENDIF - hEntry[ "DESCRIPTION" ] := "" - hEntry[ "EXAMPLES" ] := "" + hEntry[ "DESCRIPTION" ] := "" + hEntry[ "EXAMPLES" ] := "" FOR EACH cText IN ::docum_ IF !empty( cText ) hEntry[ "EXAMPLES" ] += cText + hb_eol() ENDIF NEXT - hEntry[ "TESTS" ] := "" - hEntry[ "STATUS" ] := "R" - hEntry[ "COMPLIANCE" ] := "Not Clipper compatible" - hEntry[ "PLATFORMS" ] := "Windows, Linux, Mac OS X, OS/2" - hEntry[ "VERSION" ] := cQT_VER + " or upper" - hEntry[ "FILES" ] := "" - hEntry[ "FILES" ] += "Harbour source: " + "contrib/hbqt" + iif( Empty( cLib ), "", "/" + cLib ) + "/T" + ::cQtObject + ".prg" + hb_eol() - hEntry[ "FILES" ] += "C++ wrappers : " + "contrib/hbqt" + iif( Empty( cLib ), "", "/" + cLib ) + "/" + ::cQtObject + ".cpp" + hb_eol() - hEntry[ "FILES" ] += "Library : " + "hb" + cLib + hEntry[ "TESTS" ] := "" + hEntry[ "STATUS" ] := "R" + hEntry[ "COMPLIANCE" ] := "Not Clipper compatible" + hEntry[ "PLATFORMS" ] := "Windows, Linux, Mac OS X, OS/2" + hEntry[ "VERSION" ] := cQT_VER + " or upper" + hEntry[ "FILES" ] := "" + hEntry[ "FILES" ] += "Harbour source: " + "contrib/hbqt" + iif( Empty( cLib ), "", "/" + cLib ) + "/T" + ::cQtObject + ".prg" + hb_eol() + hEntry[ "FILES" ] += "C++ wrappers : " + "contrib/hbqt" + iif( Empty( cLib ), "", "/" + cLib ) + "/" + ::cQtObject + ".cpp" + hb_eol() + hEntry[ "FILES" ] += "Library : " + "hb" + cLib #if 0 - hEntry[ "SEEALSO" ] := "" - hEntry[ "SEEALSO" ] += iif( empty( cInherits ), "", cInherits + "()" ) + hEntry[ "SEEALSO" ] := "" + hEntry[ "SEEALSO" ] += iif( empty( cInherits ), "", cInherits + "()" ) #endif RETURN hb_MemoWrit( ::cDOCFileName, __hbdoc_ToSource( { hEntry } ) ) diff --git a/harbour/include/harbour.hbx b/harbour/include/harbour.hbx index 6f816f46fa..e382e23e6b 100644 --- a/harbour/include/harbour.hbx +++ b/harbour/include/harbour.hbx @@ -1330,6 +1330,7 @@ DYNAMIC __HBARRAY DYNAMIC __HBBLOCK DYNAMIC __HBCHARACTER DYNAMIC __HBDATE +DYNAMIC __HBDOC_FILTEROUT DYNAMIC __HBDOC_FROMSOURCE DYNAMIC __HBDOC_LOADDIR DYNAMIC __HBDOC_LOADHBD diff --git a/harbour/src/rtl/hbdoc.prg b/harbour/src/rtl/hbdoc.prg index eea1d37706..74649b24d9 100644 --- a/harbour/src/rtl/hbdoc.prg +++ b/harbour/src/rtl/hbdoc.prg @@ -249,6 +249,49 @@ FUNCTION __hbdoc_ToSource( aEntry ) RETURN cSource +FUNCTION __hbdoc_FilterOut( cFile ) + LOCAL lEntry := .F. + LOCAL cLine + LOCAL cOK := "" + LOCAL nToSkip := 0 + LOCAL nEmpty := 0 + + cFile := StrTran( cFile, Chr( 13 ) ) + cFile := StrTran( cFile, Chr( 9 ), " " ) + + FOR EACH cLine IN hb_ATokens( cFile, Chr( 10 ) ) + + SWITCH AllTrim( SubStr( cLine, 4 ) ) + CASE "$DOC$" + lEntry := .T. + EXIT + CASE "$END$" + lEntry := .F. + nToSkip := 1 + EXIT + OTHERWISE + IF ! lEntry + IF nToSkip > 0 + nToSkip-- + ELSE + IF Empty( cLine ) + nEmpty++ + ELSE + nEmpty := 0 + ENDIF + IF nEmpty < 2 + cOK += cLine + IF cLine:__enumIndex() < Len( cLine:__enumBase() ) + cOK += hb_eol() + ENDIF + ENDIF + ENDIF + ENDIF + ENDSWITCH + NEXT + + RETURN cOK + /* * 0xC0, 'H', 'B', 'D' followed two-byte version number in Little Endian order. * Corresponding magic(5) rule: diff --git a/harbour/tests/stripdoc.hbs b/harbour/tests/stripdoc.hbs index cda172b838..c8adbf29b6 100644 --- a/harbour/tests/stripdoc.hbs +++ b/harbour/tests/stripdoc.hbs @@ -19,51 +19,8 @@ PROCEDURE Main() IF Right( aFile[ F_NAME ], 2 ) == ".c" .OR. ; Right( aFile[ F_NAME ], 4 ) == ".prg" - hb_MemoWrit( aFile[ F_NAME ], __hbdoc_filter_out( MemoRead( aFile[ F_NAME ] ) ) ) + hb_MemoWrit( aFile[ F_NAME ], __hbdoc_FilterOut( MemoRead( aFile[ F_NAME ] ) ) ) ENDIF NEXT RETURN - -FUNCTION __hbdoc_filter_out( cFile ) - LOCAL lEntry := .F. - LOCAL cLine - LOCAL cOK := "" - LOCAL nToSkip := 0 - LOCAL nEmpty := 0 - - cFile := StrTran( cFile, Chr( 13 ) ) - cFile := StrTran( cFile, Chr( 9 ), " " ) - - FOR EACH cLine IN hb_ATokens( cFile, Chr( 10 ) ) - - SWITCH AllTrim( SubStr( cLine, 4 ) ) - CASE "$DOC$" - lEntry := .T. - EXIT - CASE "$END$" - lEntry := .F. - nToSkip := 1 - EXIT - OTHERWISE - IF ! lEntry - IF nToSkip > 0 - nToSkip-- - ELSE - IF Empty( cLine ) - nEmpty++ - ELSE - nEmpty := 0 - ENDIF - IF nEmpty < 2 - cOK += cLine - IF cLine:__enumIndex() < Len( cLine:__enumBase() ) - cOK += hb_eol() - ENDIF - ENDIF - ENDIF - ENDIF - ENDSWITCH - NEXT - - RETURN cOK