2007-11-12 01:14 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* include/hbapi.h
     + Added xhb compatibility #define for hb_storclenAdopt()
       (equivalent to Harbour's hb_storclen_buffer())

   * contrib/xhb/hbcompat.ch
     + Added xhb IsDirectory() <-> hb_DirExists() translation.
       Harbour version works using access(), while xhb version 
       does a filefind, so Harbour will return a more accurate 
       result more quickly, but it won't work with wildcards.

   * source/rtl/persist.prg
     % Using hb_StrShrink()

   * common.mak
   * utils/hbdoc/Makefile
   * utils/hbdoc/ffile1.prg
   * utils/hbdoc/genasc.prg
   * utils/hbdoc/genchm.prg
   * utils/hbdoc/genhtm.prg
   * utils/hbdoc/genng.prg
   * utils/hbdoc/genos2.prg
   * utils/hbdoc/genpdf1.prg
   * utils/hbdoc/genrtf.prg
   * utils/hbdoc/gentrf.prg
   * utils/hbdoc/hbdoc.prg
   * utils/hbdoc/html.prg
   * utils/hbdoc/ng.prg
   * utils/hbdoc/os2.prg
   * utils/hbdoc/rtf.prg
   + utils/hbdoc/teeasc.prg
     + Synced with xhb.
     ; Someone who uses this tool, pls test.

   * common.mak
   * utils/hbmake/Makefile
   * utils/hbmake/ft_funcs.prg
   * utils/hbmake/hbmake.prg
   * utils/hbmake/hbmutils.prg
   * utils/hbmake/pickarry.prg
   * utils/hbmake/radios.prg
   + utils/hbmake/readline.c
   + utils/hbmake/tmake.prg
     + Synced with xhb.
     ; Someone who uses this tool, pls test.
This commit is contained in:
Viktor Szakats
2007-11-12 00:16:26 +00:00
parent f7de654b8b
commit 7477bf4448
29 changed files with 9356 additions and 4384 deletions

View File

@@ -8,6 +8,52 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-11-12 01:14 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* include/hbapi.h
+ Added xhb compatibility #define for hb_storclenAdopt()
(equivalent to Harbour's hb_storclen_buffer())
* contrib/xhb/hbcompat.ch
+ Added xhb IsDirectory() <-> hb_DirExists() translation.
Harbour version works using access(), while xhb version
does a filefind, so Harbour will return a more accurate
result more quickly, but it won't work with wildcards.
* source/rtl/persist.prg
% Using hb_StrShrink()
* common.mak
* utils/hbdoc/Makefile
* utils/hbdoc/ffile1.prg
* utils/hbdoc/genasc.prg
* utils/hbdoc/genchm.prg
* utils/hbdoc/genhtm.prg
* utils/hbdoc/genng.prg
* utils/hbdoc/genos2.prg
* utils/hbdoc/genpdf1.prg
* utils/hbdoc/genrtf.prg
* utils/hbdoc/gentrf.prg
* utils/hbdoc/hbdoc.prg
* utils/hbdoc/html.prg
* utils/hbdoc/ng.prg
* utils/hbdoc/os2.prg
* utils/hbdoc/rtf.prg
+ utils/hbdoc/teeasc.prg
+ Synced with xhb.
; Someone who uses this tool, pls test.
* common.mak
* utils/hbmake/Makefile
* utils/hbmake/ft_funcs.prg
* utils/hbmake/hbmake.prg
* utils/hbmake/hbmutils.prg
* utils/hbmake/pickarry.prg
* utils/hbmake/radios.prg
+ utils/hbmake/readline.c
+ utils/hbmake/tmake.prg
+ Synced with xhb.
; Someone who uses this tool, pls test.
2007-11-11 22:26 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* common.mak
* source/rtl/Makefile

View File

@@ -1007,6 +1007,7 @@ HBDOC_EXE_OBJS = \
$(OBJ_DIR)\genos2$(OBJEXT) \
$(OBJ_DIR)\genrtf$(OBJEXT) \
$(OBJ_DIR)\gentrf$(OBJEXT) \
$(OBJ_DIR)\teeasc$(OBJEXT) \
$(OBJ_DIR)\html$(OBJEXT) \
$(OBJ_DIR)\ng$(OBJEXT) \
$(OBJ_DIR)\os2$(OBJEXT) \
@@ -1040,6 +1041,8 @@ HBMAKE_EXE_OBJS = \
$(OBJ_DIR)\ffile1$(OBJEXT) \
$(OBJ_DIR)\ft_funcs$(OBJEXT) \
$(OBJ_DIR)\hbmlang$(OBJEXT) \
$(OBJ_DIR)\readline$(OBJEXT) \
$(OBJ_DIR)\tmake$(OBJEXT) \
#**********************************************************

View File

@@ -69,6 +69,7 @@
#xtranslate hb_adler32([<x,...>]) => hb_checksum(<x>)
#xtranslate hb_setLastKey([<x,...>])=> setLastKey(<x>)
#xtranslate hb_CStr([<x,...>]) => CStr(<x>)
#xtranslate hb_DirExists(<x>) => IsDirectory(<x>)
#xtranslate hb_HexToNum([<c,...>]) => HexToNum(<c>)
#xtranslate hb_NumToHex([<n,...>]) => NumToHex(<n>)
@@ -126,6 +127,7 @@
#xtranslate hb_checksum([<x,...>]) => hb_adler32(<x>)
#xtranslate setLastKey([<x,...>]) => hb_setLastKey(<x>)
#xtranslate CStr([<x,...>]) => hb_CStr(<x>)
#xtranslate IsDirectory(<x>) => hb_DirExists(<x>)
#xtranslate HexToNum([<c,...>]) => hb_HexToNum(<c>)
#xtranslate NumToHex([<n,...>]) => hb_NumToHex(<n>)

View File

@@ -634,6 +634,7 @@ extern HB_EXPORT void hb_retnlllen( LONGLONG lNumber, int iWidth ); /* returns
#define hb_retcAdopt( szText ) hb_retc_buffer( (szText) )
#define hb_retclenAdopt( szText, ulLen ) hb_retclen_buffer( (szText), (ulLen) )
#define hb_retcStatic( szText ) hb_retc_const( (szText) )
#define hb_storclenAdopt hb_storclen_buffer
#ifdef HB_API_MACROS

View File

@@ -234,13 +234,13 @@ static function ExtractLine( cText, nFrom )
if nAt > 0
cText := SubStr( cText, nFrom, nAt - nFrom )
if Right( cText, 1 ) == Chr( 13 )
cText := Left( cText, Len( cText ) - 1 )
cText := hb_StrShrink( cText, 1 )
endif
nFrom := nAt + 1
else
cText := SubStr( cText, nFrom )
if Right( cText, 1 ) == Chr( 13 )
cText := Left( cText, Len( cText ) - 1 )
cText := hb_StrShrink( cText, 1 )
endif
nFrom += Len( cText ) + 1
endif

View File

@@ -18,6 +18,7 @@ PRG_SOURCES=\
genrtf.prg \
genhpc.prg \
genasc.prg \
teeasc.prg \
html.prg \
ng.prg \
os2.prg \

View File

@@ -72,8 +72,6 @@ CLASS FileBase FROM FileMan
DATA nPosition // This holds the position in the file at
DATA lAtBottom // This is a value to show if at bottom of file
DATA lAtTop // This is a value to show if at top of file
DATA cCRLF // OS dependant End of Line marker
DATA nCRLFLen // Length of cCRLF
METHOD new( cname ) // This is the constructor for the file
METHOD FOPEN() // This opens the specified file
@@ -104,7 +102,7 @@ ENDCLASS
*/
METHOD new( cName ) CLASS FileBase
::super:new()
super:new()
// first thing to do is check to see if there is a valid file
::nSkipLength := 1
@@ -112,9 +110,6 @@ METHOD new( cName ) CLASS FileBase
::nCreateMode := 0 // Mode for which to create the file
::cName := cName
::cCRLF := HB_OSNewLine() // Set our End of Line marker
::nCRLFLen := len(::cCRLF) // and its length
RETURN ( self )
@@ -365,15 +360,15 @@ METHOD goBottom() CLASS FileBase
cBuffer := SPACE( pBUFFER_LENGTH )
FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), 2 )
FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH )
IF RIGHT( cBuffer, ::nCRLFLen ) == ::cCRLF // We need to remove this extra one!
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - ::nCRLFLen )
IF RIGHT( cBuffer, 2 ) == pCRLF // We need to remove this extra one!
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - 2 )
lWithCRLF := pTRUE
ENDIF
cBuffer := SUBSTR( cBuffer, RAT( ::cCRLF, cBuffer ) + ::nCRLFLen )
::nSkipLength := LEN( cBuffer ) + IF( lWithCRLF, ::nCRLFLen, 0 )
cBuffer := SUBSTR( cBuffer, RAT( pCRLF, cBuffer ) + 2 )
::nSkipLength := LEN( cBuffer ) + IF( lWithCRLF, 2, 0 )
::nposition := FSEEK( Self:nDosHandle, - ( LEN( cBuffer ) ), 2 )
IF lWithCRLF
::nposition := FSEEK( Self:nDosHandle, -( ::nCRLFLen), 1 )
::nposition := FSEEK( Self:nDosHandle, - 2, 1 )
ENDIF
ENDIF
@@ -458,11 +453,11 @@ METHOD WRITE( cChar ) CLASS FileBase
cBuffer := SPACE( ::nposition - nRead )
FREAD( Self:nDosHandle, @cBuffer, ( ::nposition - nRead ) )
IF RIGHT( cBuffer, ::nCRLFLen ) == ::cCRLF // with line already
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - ::nCRLFLen )
IF RIGHT( cBuffer, 2 ) == pCRLF // with line already
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - 2 )
lWithCRLF := pTRUE
ENDIF
nLocation := LEN( cBuffer ) - ( RAT( ::cCRLF, cBuffer ) )
nLocation := LEN( cBuffer ) - ( RAT( pCRLF, cBuffer ) )
ELSE
cBuffer := SPACE( pBUFFER_LENGTH )
@@ -472,7 +467,7 @@ METHOD WRITE( cChar ) CLASS FileBase
// Now, parse the string. and file
nLocation := AT( ::cCRLF, cBuffer )
nLocation := AT( pCRLF, cBuffer )
// Now, if there is NO CRLF in the buffer and if the value of the
// number of bytes read is less than the buffer length, then we
@@ -500,8 +495,8 @@ METHOD appendLine( cLine ) CLASS FileBase
IF LEN( cLine ) == 0 // Valid line
IF Self:noDosError() .AND. Self:nDosHandle > 0 // No error
IF !( ::cCRLF $ cLine ) // No CRLF, so add
cLIne += ::cCRLF
IF !( pCRLF $ cLine ) // No CRLF, so add
cLIne += pCRLF
ENDIF
FSEEK( Self:nDosHandle, 0, 2 )
FWRITE( Self:nDosHandle, cLine )
@@ -577,12 +572,12 @@ METHOD GOTO( nValue ) CLASS FileBase
lContinue := ( FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH ) == ;
pBUFFER_LENGTH )
cBuffer := cLine + cBuffer
WHILE ::cCRLF $ cBuffer
WHILE pCRLF $ cBuffer
IF ++ nCount == nValue
lContinue := pFALSE
EXIT
ENDIF
cBuffer := SUBSTR( cBuffer, AT( ::cCRLF, cBuffer ) + ::nCRLFLen )
cBuffer := SUBSTR( cBuffer, AT( pCRLF, cBuffer ) + 2 )
ENDDO
cLine := cBuffer
ENDDO
@@ -624,11 +619,11 @@ METHOD BufferGet( lForward ) CLASS FileBase
cBuffer := SPACE( ::nposition - nRead )
FREAD( Self:nDosHandle, @cBuffer, ( ::nposition - nRead ) )
IF RIGHT( cBuffer, ::nCRLFLen ) == ::cCRLF // with line already
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - ::nCRLFLen )
IF RIGHT( cBuffer, 2 ) == pCRLF // with line already
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - 2 )
lWithCRLF := pTRUE
ENDIF
nLocation := LEN( cBuffer ) - ( RAT( ::cCRLF, cBuffer ) )
nLocation := LEN( cBuffer ) - ( RAT( pCRLF, cBuffer ) )
ELSE
cBuffer := SPACE( pBUFFER_LENGTH )
@@ -638,7 +633,7 @@ METHOD BufferGet( lForward ) CLASS FileBase
// Now, parse the string. and file
nLocation := AT( ::cCRLF, cBuffer )
nLocation := AT( pCRLF, cBuffer )
// Now, if there is NO CRLF in the buffer and if the value of the
// number of bytes read is less than the buffer length, then we

View File

@@ -132,7 +132,7 @@ FUNCTION ASCIIFiles()
LOCAL cSeeAlso
LOCAL cTemp
LOCAL cChar
LOCAL nDocCnt
LOCAL nDocCnt := 0
LOCAL lBlankLine := .F. // Blank line encountered and sent out
LOCAL lAddBlank := .F. // Need to add a blank line if next line is not blank
LOCAL lFunc := .T. // currently a function rather than a command
@@ -248,7 +248,7 @@ FUNCTION ASCIIFiles()
ENDIF
FWRITE( nWriteHandle, CRLF )
FWRITE( nWriteHandle, " Source: " + aDirList[ i, F_NAME ] + CRLF + CRLF )
IF lAuthor
IF lAuthor .and. !empty( cAuthor )
FWRITE( nWriteHandle, " Author: " + cAuthor + CRLF )
ENDIF
IF .NOT. EMPTY( cSeeAlso )
@@ -308,7 +308,7 @@ FUNCTION ASCIIFiles()
nEnd := 1
nCount := 0
DO WHILE nEnd > 0
nEnd := ASCAN( aDocInfo, { | a | a[ 4 ] == cFileName + ".hdf" } )
nEnd := ASCAN( aDocInfo, { | a | a[ 4 ] == cFileName + ".txt" } )
IF nEnd > 0
// This will break if there are more than 10 files with the same first
@@ -324,12 +324,12 @@ FUNCTION ASCIIFiles()
ENDDO
// Add on the extension
cFileName := LEFT( cFileName, 8 ) + ".hdf"
cFileName := LEFT( cFileName, 8 ) + ".txt"
nWriteHandle := FCREATE( "hdf\" + cFileName )
nWriteHandle := FCREATE( "txt\" + cFileName )
IF nWriteHandle < 1
? "Error creating", cFileName, ".hdf"
WRITE_ERROR( "Error creating",,,, cFileName + ".hdf" )
? "Error creating", cFileName, ".txt"
WRITE_ERROR( "Error creating",,,, cFileName + ".txt" )
ENDIF
// 2) Category
ELSEIF AT( cCat, cBuffer ) > 0

View File

@@ -4,7 +4,7 @@
/*
* Harbour Project source code:
* GENCHM support module for hbdoc document Extractor
* GENCHM support module for hbdoc document Extractor
*
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
* www - http://www.harbour-project.org
@@ -71,6 +71,7 @@ MEMVAR aDirList
MEMVAR aDocInfo
MEMVAR aWww
MEMVAR aResult
STATIC aAlso
STATIC aFiTable := {}
STATIC aSiTable := {}
@@ -86,6 +87,14 @@ STATIC lWasTestExamples := .f.
STATIC aColorTable := { 'aqua', 'black', 'fuchia', 'grey', 'green', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red', 'silver', 'teal', 'white', 'yellow' }
// Static variables added for the chm2 addition
STATIC nArrayItem := 1 // Index used to loop through the array of the array
STATIC nArrayItemLine := 1 // Index used to loop through the items in the array of the array
STATIC oHtmClass
STATIC oHtmClassContent
STATIC cFileName := "" // Stores filenames of files that will be created
STATIC cInherits := "" // Stores the inheritance of a class (if known and present)
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
*+ Function ProcessWww()
@@ -137,7 +146,6 @@ FUNCTION ProcessChm()
LOCAL lEndSyntax := .F.
LOCAL lEndReturns := .F.
LOCAL lEndData := .F.
LOCAL lBlankLine := .F. // Blank line encountered and sent out
LOCAL lAddBlank := .F. // Need to add a blank line if next line is not blank
LOCAL oChm
@@ -181,8 +189,8 @@ FUNCTION ProcessChm()
// Entry Point
//
// Put up information labels
@ INFILELINE, 20 SAY "Extracting: "
@ MODULELINE, 20 SAY "Documenting: "
@ INFILELINE, 20 SAY "Extracting: "
@ MODULELINE, 20 SAY "Documenting: "
// loop through all of the files
lFirstArg := .T.
lFirstPass := .T.
@@ -319,7 +327,7 @@ FUNCTION ProcessChm()
// Open a new file
IF AT( "FT_", cFuncName ) > 0
cTemp := upper(SUBSTR( cFuncName, 4 ))
cTemp := upper(SUBSTR( cFuncName, 4 ))
ELSE
cTemp := upper(cFuncName)
ENDIF
@@ -792,6 +800,489 @@ oChm:writeText("<br>") //:endpar()
NEXT
RETURN nil
FUNCTION ProcessChm2()
LOCAL aTempArray := {} // Temporary array used for storing list of methods and properties
LOCAL cTempString // Temporary string used for storing random strings
LOCAL cTempString2 // Temporary string used for storing random strings
LOCAL cTemp
LOCAL nEnd
LOCAL j
LOCAL cChar
LOCAL nCount
LOCAL cDocType := ""
LOCAL nClassNamePos // Stores the position in the array where the classname can be found
LOCAL nFunctionNamePos // Stores the position in the array where the functionname can be found
LOCAL nReadHandle // Stores the text file's workarea
LOCAL nSubArrayItem := 1 // Index used to loop through the items of the array of the array
LOCAL nTemp1 := 1 // Used to scroll through the DirList array
LOCAL nTemp2 := 1 // Used to scroll through the aFunctionItems array
LOCAL nPropertyListAnker // Used to add an html-anker in the page
LOCAL nMethodListAnker // Used to add an html-anker in the page
LOCAL aFunctionItems := {{"Category", "Category"}, {"Syntax", "Syntax"}, {"Arguments", "Arguments"}, ;
+ {"Returns", "Returns"}, {"Description", "Description"}, {"Examples", "Examples"}, {"Tests", "Tests"}, ;
+ {"Status", "Status"}, {"Compliance", "Compliance"}, {"Platforms", "Platforms"}, {"Files", "Files"}, ;
+ {"Seealso", "See also"}}
FOR nTemp1 := 1 TO LEN(aDirList)
// Calculate the amount of characters the source files uses each line
nCommentLen := IIF(AT(".ASM", UPPER(aDirList[nTemp1, F_NAME])) > 0, 2, 4)
// Select the file to read from
nReadHandle := FT_FUSE(aDirList[nTemp1, F_NAME])
IF nReadHandle < 0
WRITE_ERROR("Can't open file: (Dos Error " + STR( FERROR() ) + ")",,,, aDirList[ nTemp1, F_NAME ])
@ ERRORLINE, 0 CLEAR TO ERRORLINE, MAXCOL()
@ ERRORLINE, 20 SAY "Can't open file: (Dos Error " + STR( FERROR() ) + ") File=" + aDirList[ nTemp1, F_NAME ]
LOOP
ENDIF
// Read the entire file into the aCurDoc array
ReadFromTop3(nReadHandle)
// Generate a new document, based on the name of the class or function
// Check if the file contains a class or function definition
IF LEN(aCurDoc) > 0 .AND. nArrayItem <= LEN(aCurDoc)
IF ASCAN(aCurDoc[nArrayItem], " $CLASSDOC$") > 0
cDocType := "Class"
nClassNamePos := ASCAN(aCurDoc[nArrayItem], " $CLASS$", ASCAN(aCurDoc[nArrayItem], " $CLASSDOC$") + 1) + 1
cFileName := aCurDoc[nArrayItem][nClassNamePos]
ELSEIF ASCAN(aCurDoc[nArrayItem], " $DOC$") > 0
cDocType := "Function"
nFunctionNamePos := ASCAN(aCurDoc[nArrayItem], " $FUNCNAME$") + 1
cFileName := aCurDoc[nArrayItem][nFunctionNamePos]
ELSE
LOOP
ENDIF
// Check whether the function name has "FT_" in it, if so, ignore the first three characters
IF AT("FT_", cFileName) > 0
cTemp := UPPER(SUBSTR(cFileName, 4))
ELSE
cTemp := UPPER(cFileName)
ENDIF
// Check whether the function name has "(" in it, if so, ignore it + the following chars
IF (nEnd := AT("(", cTemp)) > 0
cTemp := LEFT(cTemp, nEnd - 1)
ENDIF
// Strip off any other non-alphabetical or -numeric characters
cFileName := ""
FOR j := 1 TO LEN( cTemp )
cChar := SUBSTR( cTemp, j, 1 )
IF ( cChar >= "0" .AND. cChar <= "9" ) .OR. ( cChar >= "A" .AND. cChar <= "Z" ) .OR. cChar = "_"
cFileName += cChar
ENDIF
NEXT
// Check whether the file name already exists, if so, modify the name
cFileName := LEFT(cFileName, 36)
nEnd := 1
nCount := 0
DO WHILE nEnd > 0
nEnd := ASCAN(aDocInfo, { | a | a[ 2 ] == cFileName + ".htm" })
IF nEnd > 0
IF LEN( cFileName ) = 36
cFileName := STUFF( cFileName, 36, 1, STR( nCount, 1, 0 ) )
ELSE
cFileName = cFileName + STR( nCount, 1, 0 )
ENDIF
nCount ++
ENDIF
ENDDO
// Add the file extension
cFileName := LEFT( cFileName, 36 ) + ".htm"
oHtmClass := THTML():New( 'chm\' + cFileName )
// If file creation was successful
IF oHtmClass:nHandle > 0
// Add a title to the HTML
nPropertyListAnker := .F.
nMethodListAnker := .F.
// Add CSS to the HTML
oHtmClass:WriteText("<style>")
oHtmClass:WriteText("body {font-family:arial;font-size:14px;line-height:18px;}")
oHtmClass:WriteText(".classtitle {font-weight:bold;font-size:22px;padding-bottom:4px;}")
oHtmClass:WriteText(".oneliner {font-style:italic;margin-bottom:12px;}")
oHtmClass:WriteText(".itemtitle {font-weight:bold;margin-left:8px;padding-bottom:2px;}")
oHtmClass:WriteText(".itemtext {margin-left:20px;padding-bottom:6px;}")
oHtmClass:WriteText("</style>")
// Loop through the first array (list with arrays)
DO WHILE nArrayItem <= LEN(aCurDoc)
nSubArrayItem := 1
IF cDocType = "Class"
// Loop through the second array (list with methods, properties, ...)
IF ASCAN(aCurDoc[nArrayItem], " $CLASS$") > 0
// Write class name
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "CLASS" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClass:WriteText("<title>" + cTempString + " - Class overview</title></head><body>")
oHtmClass:WriteText("<div class='classtitle'>Class " + cTempString + "</div>")
// Add classname and filename to the docinfo array
AADD(aDocInfo, { cTempString, cFileName, "C1", {} })
// Write oneliner
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "ONELINER" $ UPPER(a)}) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClass:WriteText("<div class='oneliner'>" + cTempString + "</div>")
// Write inheritance
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "INHERITS" $ UPPER(a)}) + 1
IF nArrayItemLine - 1 <> 0 .AND. !EMPTY(aCurDoc[nArrayItem][nArrayItemLine]) //.AND. FILE(aCurDoc[nArrayItem][nArrayItemLine] + ".txt")
cInherits := aCurDoc[nArrayItem][nArrayItemLine]
cTempString := "<a href='" + cInherits + ".htm'>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine]) + "</a>"
ELSE
cTempString := "-"
ENDIF
oHtmClass:WriteText("<div class='itemtitle'>&raquo; " + "Inherits" + "</div>")
oHtmClass:WriteText("<div class='itemtext'>" + cTempString + "</div>")
WriteClass3("Constructor", "Constructor")
WriteClass3("Syntax", "Syntax")
WriteClass3("Arguments", "Arguments")
WriteClass3("Returns", "Returns")
WriteClassDataMethod3("Method", "Methods", nArrayItem, nArrayItemLine)
WriteClassDataMethod3("Data", "Properties", nArrayItem, nArrayItemLine)
WriteClass3("Category", "Category")
WriteClass3("Description", "Description")
WriteClass3("Seealso", "See also")
oHtmClass:WriteText("</body></html>")
// Create new HTML for the properties and methods
IF LEN(aCurDoc) > 1
cFileName := LEFT(cFileName, LEN(cFileName) - 4) + "_content.htm"
oHtmClassContent := THTML():New( 'chm\' + cFileName )
IF oHtmClassContent:nHandle > 0
// Add a title to the HTML
oHtmClassContent:WriteText("<title>Harbour - Reference Guide</title>")
// Add CSS to the HTML
oHtmClassContent:WriteText("<style>")
oHtmClassContent:WriteText("body {font-family:arial;font-size:14px;line-height:18px;}")
oHtmClassContent:WriteText(".classtitle {font-weight:bold;font-size:22px;padding-bottom:4px;}")
oHtmClassContent:WriteText(".title {font-weight:bold;font-size:18px;padding-bottom:2px;padding-top:8px;}")
oHtmClassContent:WriteText(".oneliner {font-style:italic;margin-bottom:8px;}")
oHtmClassContent:WriteText(".itemtitle {font-weight:bold;margin-left:8px;padding-bottom:2px;}")
oHtmClassContent:WriteText(".itemtext {margin-left:20px;padding-bottom:6px;}")
oHtmClassContent:WriteText("</style>")
// Write class name
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "CLASS" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClass:WriteText("<title>" + cTempString + " - Class details</title></head><body>")
oHtmClassContent:WriteText("<div class='classtitle'>Class " + cTempString + "</div>")
ENDIF
ENDIF
ELSEIF ASCAN(aCurDoc[nArrayItem], " $DATA$") > 0
IF oHtmClassContent:nHandle > 0
// Write property name
IF nPropertyListAnker = .F.
oHtmClassContent:WriteText("<a name='propertylist'>")
nPropertyListAnker = .t.
ENDIF
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "DATA" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClassContent:WriteText("<div class='title'><a name='" + cTempString + "'>Property " + cTempString + "</a></div>")
//IF ASCAN(aDocInfo, {|a| a[2] = cFileName} ) > 0
//?? cFileName
//AADD(aDocInfo[ASCAN(aDocInfo, {|a| a[2] = cFileName} )][4] := {cTempString, "D"}
//ENDIF
AADD(aDocInfo[LEN(aDocInfo)][4], {"Data", cTempString})
// Write property oneliner
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "ONELINER" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClassContent:WriteText("<div class='oneliner'>" + cTempString + "</div>")
WriteData3("Category", "Category")
WriteData3("Description", "Description")
ENDIF
ELSEIF ASCAN(aCurDoc[nArrayItem], " $METHOD$") > 0
IF oHtmClassContent:nHandle > 0
// Write method name
IF nMethodListAnker = .F.
oHtmClassContent:WriteText("<a name='methodlist'>")
nMethodListAnker = .t.
ENDIF
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "METHOD" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClassContent:WriteText("<div class='title'><a name='" + cTempString + "'>Method " + cTempString + "</a></div>")
AADD(aDocInfo[LEN(aDocInfo)][4], {"Method", cTempString})
// Write method oneliner
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "ONELINER" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClassContent:WriteText("<div class='oneliner'>" + cTempString + "</div>")
WriteMethod3("Syntax", "Syntax")
WriteMethod3("Arguments", "Arguments")
WriteMethod3("Returns", "Returns")
WriteMethod3("Description", "Description")
ENDIF
ELSE
// ...
ENDIF
ELSE
// Write function name
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "FUNCNAME" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClass:WriteText("<div class='classtitle'>Function " + cTempString + "</div>")
// Add function name and filename to the docinfo array
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "CATEGORY" $ UPPER(a)}, 2) + 1
cTempString2 := aCurDoc[nArrayItem][nArrayItemLine]
IF cTempString2 $ "WinAPI"
AADD( aDocInfo, { cTempString, cFileName, "F2" } )
ELSE
AADD( aDocInfo, { cTempString, cFileName, "F1" } )
ENDIF
// Write function oneliner
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "ONELINER" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClass:WriteText("<div class='oneliner'>" + cTempString + "</div>")
// Write selected function items
DO WHILE nTemp2 <= LEN(aFunctionItems)
WriteFunction3(aFunctionItems[nTemp2][1], aFunctionItems[nTemp2][2])
nTemp2 ++
ENDDO
ENDIF
nArrayItem ++
ENDDO
IF cDocType = "Class"
oHtmClassContent:WriteText("</body></html>")
ELSE
oHtmClass:WriteText("</body></html>")
ENDIF
//aDocInfo[1][4] := {}
ELSE
// HTML file could not be created, skip current source file
LOOP
ENDIF
ENDIF
NEXT
RETURN NIL
FUNCTION ReadFromTop3(nh)
LOCAL cBuffer := ''
LOCAL aTempArray := {}
DO WHILE FReadLine(nH, @cBuffer, 4096)
cBuffer := TRIM(SUBSTR(cBuffer, nCommentLen))
AADD(aTempArray, cBuffer)
IF AT(DELIM + "END" + DELIM, cBuffer) > 0
AADD(aCurdoc, aTempArray)
aTempArray := {}
ENDIF
ENDDO
FT_FGOTOP()
RETURN NIL
FUNCTION WriteClass3(cItem, cTitle)
LOCAL cTempString
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| UPPER(cItem) $ UPPER(a)}) + 1
IF nArrayItemLine - 1 <> 0
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ELSE
cTempString := "-"
ENDIF
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClass:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClass:WriteText("<div class='itemtext'>" + cTempString + "</div>")
RETURN NIL
FUNCTION WriteClassDataMethod3(cItem, cTitle, nArrayItem, nArrayItemLine)
LOCAL cTempString
LOCAL nPrevArrayItem := nArrayItem
LOCAL nPrevArrayItemLine := nArrayItemLine
LOCAL aTmpArray := {}
LOCAL nTmpCount := 1
nArrayItem ++
cTempString := ""
DO WHILE nArrayItem <= LEN(aCurDoc)
nArrayItemLine := ASCAN(aCurDoc[nArrayItem], {|a| "$" + UPPER(cItem) + "$" $ UPPER(a)}) + 1
IF nArrayItemLine -1 <> 0
AADD(aTmpArray, {"&bull; <a href='" + LOWER(LEFT(cFileName, LEN(cFileName) - 4)) + "_content.htm#" + aCurDoc[nArrayItem][nArrayItemLine] + "' target=_self>" + aCurDoc[nArrayItem][nArrayItemLine] + "</a><br>", aCurDoc[nArrayItem][nArrayItemLine]})
nTmpCount ++
ENDIF
nArrayItem ++
ENDDO
ASORT(aTmpArray,,, {|x, y| UPPER(x[2]) < UPPER(y[2])})
FOR nTmpCount := 1 TO LEN(aTmpArray)
cTempString = cTempString + aTmpArray[nTmpCount][1]
NEXT
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClass:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClass:WriteText("<div class='itemtext'>" + cTempString + "</div>")
nArrayItem = nPrevArrayItem
nArrayItemLine = nPrevArrayItemLine
LinkInheritance3(cItem)
RETURN NIL
FUNCTION LinkInheritance3(cItem)
LOCAL nTemp1 := 1
DO WHILE nTemp1 <= LEN(aDirList)
IF UPPER(aDirList[nTemp1][1]) = UPPER(cInherits + ".TXT")
oHtmClass:WriteText("<div class='itemtext'>&bull; <a href='" + cInherits + "_content.htm#" + IIF(UPPER(cItem) = "DATA", "propertylist", "methodlist") + "' target=_self>" + IIF(cItem ="Data", "Properties", "Methods") + " inherited via " + cInherits + "</a></div>")
ENDIF
nTemp1 ++
ENDDO
RETURN NIL
FUNCTION WriteData3(cItem, cTitle)
LOCAL cTempString
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| UPPER(cItem) $ UPPER(a)}) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClassContent:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClassContent:WriteText("<div class='itemtext'>" + cTempString + "</div>")
RETURN NIL
FUNCTION WriteMethod3(cItem, cTitle)
LOCAL cTempString
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| UPPER(cItem) $ UPPER(a)}) + 1
cTempString := HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClassContent:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClassContent:WriteText("<div class='itemtext'>" + cTempString + "</div>")
RETURN NIL
FUNCTION WriteFunction3(cItem, cTitle)
LOCAL cTempString
nArrayItemLine := ASCAN(aCurDoc[nArrayItem], {|a| UPPER(cItem) $ UPPER(a)}) + 1
cTempString := aCurDoc[nArrayItem][nArrayItemLine]
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat3(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClass:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClass:WriteText("<div class='itemtext'>" + cTempString + "</div>")
RETURN NIL
FUNCTION HTMFormat3(cTempString)
LOCAL cTmpString1 := cTempString
LOCAL cTmpString2 := ""
LOCAL cTmpChar := ""
LOCAL nTmpCount := 1
DO WHILE nTmpCount <= LEN(cTmpString1)
cTmpChar := SUBSTR(cTmpString1, nTmpCount, 1)
DO CASE
CASE cTmpChar = "<"
cTmpString2 = cTmpString2 + "&lt;"
CASE cTmpChar = ">"
cTmpString2 = cTmpString2 + "&gt;"
OTHERWISE
cTmpString2 = cTmpString2 + cTmpChar
ENDCASE
nTmpCount ++
ENDDO
RETURN cTmpString2
/***********************************
* Function ProcChmBuf(cBuffer) -> cTemp
* Parameter cBuffer -> Strip the "<" and ">" symbols from the imput String
@@ -920,7 +1411,7 @@ RETURN nil
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
FUNCTION FormatChmBuff( cBuffer, cStyle, oChm )
FUNCTION FormatChmBuff( cBuffer, cStyle )
LOCAL creturn := ''
LOCAL cline := ''
@@ -929,9 +1420,7 @@ FUNCTION FormatChmBuff( cBuffer, cStyle, oChm )
LOCAL lEndBuffer := .f.
LOCAL lArgBold := .f.
LOCAL npos
HB_SYMBOL_UNUSED( oChm )
//LOCAL nposend // Variable not used in fucntion, it may be deleted?
creturn := cBuffer + ' '
IF AT( '</par>', creturn ) > 0 .OR. EMPTY( cBuffer )
IF EMPTY( cbuffer )
@@ -1143,7 +1632,7 @@ FUNCTION ProcChmDesc( cBuffer, oChm, cStyle )
cbuffer := cReturn
ENDIF
ELSE
cBuffer := FormatChmBuff( cBuffer, cStyle, oChm )
cBuffer := FormatChmBuff( cBuffer, cStyle )
ENDIF
ENDIF
ENDIF
@@ -1439,4 +1928,4 @@ STATIC FUNCTION GetItem( cItem, nCurdoc )
ENDIF
RETURN lReturn
*+ EOF: GENNG.PRG
*+ EOF: GENNG.PRG

View File

@@ -68,7 +68,7 @@
#define LONGLINE 600
#define LONGONELINE 86
MEMVAR aDirList
MEMVAR aDocInfo
MEMVAR aDocInfo, aDocwwwInfo
MEMVAR aWww,aResult
STATIC aAlso
@@ -80,11 +80,22 @@ STATIC lEof
STATIC aFoiTable := {}
STATIC atiTable := {}
STATIC nNumTableItems := 0
STATIC aCurDoc := {}
STATIC aCurDoc := {} // x
static cLastText := ""
Static clastBuffer := ""
STATIC nCurDoc := 1
STATIC lWasTestExamples := .f.
STATIC aColorTable := { 'aqua', 'black', 'fuchia', 'grey', 'green', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red', 'silver', 'teal', 'white', 'yellow' }
// Static variables added for the htm2 addition
STATIC cDocType := ""
STATIC nArrayItem := 1 // Index used to loop through the array of the array
STATIC nArrayItemLine := 1 // Index used to loop through the items in the array of the array
STATIC oHtmClass
STATIC oHtmClassContent
STATIC cFileName := "" // Stores filenames of files that will be created
STATIC cInherits := "" // Stores the inheritance of a class (if known and present)
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
*+ Function ProcessWww()
@@ -136,7 +147,6 @@ FUNCTION ProcessWww()
LOCAL lEndSyntax := .F.
LOCAL lEndReturns := .F.
LOCAL lEndData := .F.
LOCAL lBlankLine := .F. // Blank line encountered and sent out
LOCAL lAddBlank := .F. // Need to add a blank line if next line is not blank
LOCAL oHtm
@@ -176,9 +186,6 @@ FUNCTION ProcessWww()
LOCAL cData := DELIM + "DATA" + DELIM
LOCAL cMethod := DELIM + 'METHOD' + DELIM
LOCAL cClassDoc := DELIM + "CLASSDOC" + DELIM
#ifdef GAUGE
Local aGauge,agauge1
#endif
LOCAL nDocs:=0
//
// Entry Point
@@ -197,7 +204,7 @@ FUNCTION ProcessWww()
nCommentLen := IIF( AT( ".ASM", UPPER( aDirList[ i, F_NAME ] ) ) > 0, 2, 4 )
nReadHandle := FT_FUSE( aDirList[ i, F_NAME ] )
#ifdef GAUGE
if i == 1
if i == 1
aGauge1:= Gauge():New( 5, 5, 7, MaxCol() - 5)
Endif
#endif
@@ -393,11 +400,11 @@ FUNCTION ProcessWww()
cFileName := LEFT( cFileName, 36 ) + ".htm"
IF lDoc
oHtm := THTML():New( 'htm/' + cFileName )
oHtm := THTML():New( 'htm\' + cFileName )
ENDIF
IF lFirstPass .AND. lClassDoc
lFirstPass := .F.
oHtm := THTML():New( 'htm/' + cFileName )
oHtm := THTML():New( 'htm\' + cFileName )
ENDIF
IF ohtm:nHandle < 1
? "Error creating", cFileName, ".htm"
@@ -447,8 +454,7 @@ FUNCTION ProcessWww()
cBuffer := ReadLN( @lEof )
nLineCnt ++
// get the category
cCategory := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
cCategory := strtran( cCategory, hb_OSNewLine(), '' )
cCategory := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
// 3) One line description
@@ -666,7 +672,7 @@ oHtm:writeText("<br>") //:endpar()
IF lAddBlank
lAddBlank := .F.
ENDIF
prochtmdesc( cbuffer, oHtm, "Syntax" )
prochtmdesc( cbuffer, oHtm, "Syntax" ,cFileName)
ELSEIF nMode = D_ARG
IF LEN( cBuffer ) > LONGLINE
@@ -800,6 +806,478 @@ oHtm:writeText("<br>") //:endpar()
NEXT
RETURN nil
FUNCTION ProcessWww2()
LOCAL aTempArray := {} // Temporary array used for storing list of methods and properties
LOCAL cTempString // Temporary string used for storing random strings
LOCAL cTempString2 // Temporary string used for storing random strings
LOCAL nClassNamePos // Stores the position in the array where the classname can be found
LOCAL nFunctionNamePos // Stores the position in the array where the functionname can be found
LOCAL nReadHandle // Stores the text file's workarea
LOCAL nSubArrayItem := 1 // Index used to loop through the items of the array of the array
LOCAL nTemp1 := 1 // Used to scroll through the DirList array
LOCAL nTemp2 := 1 // Used to scroll through the aFunctionItems array
LOCAL nPropertyListAnker // Used to add an html-anker in the page
LOCAL nMethodListAnker // Used to add an html-anker in the page
LOCAL aFunctionItems := {{"Category", "Category"}, {"Syntax", "Syntax"}, {"Arguments", "Arguments"}, ;
+ {"Returns", "Returns"}, {"Description", "Description"}, {"Examples", "Examples"}, {"Tests", "Tests"}, ;
+ {"Status", "Status"}, {"Compliance", "Compliance"}, {"Platforms", "Platforms"}, {"Files", "Files"}, ;
+ {"Seealso", "See also"}}
LOCAL cTemp
LOCAL nEnd
LOCAL j
LOCAL nCount
LOCAL cChar
FOR nTemp1 := 1 TO LEN(aDirList)
// Calculate the amount of characters the source files uses each line
nCommentLen := IIF(AT(".ASM", UPPER(aDirList[nTemp1, F_NAME])) > 0, 2, 4)
// Select the file to read from
nReadHandle := FT_FUSE(aDirList[nTemp1, F_NAME])
IF nReadHandle < 0
WRITE_ERROR("Can't open file: (Dos Error " + STR( FERROR() ) + ")",,,, aDirList[ nTemp1, F_NAME ])
@ ERRORLINE, 0 CLEAR TO ERRORLINE, MAXCOL()
@ ERRORLINE, 20 SAY "Can't open file: (Dos Error " + STR( FERROR() ) + ") File=" + aDirList[ nTemp1, F_NAME ]
LOOP
ENDIF
// Read the entire file into the aCurDoc array
ReadFromTop2(nReadHandle)
// Generate a new document, based on the name of the class or function
// Check if the file contains a class or function definition
IF LEN(aCurDoc) > 0 .AND. nArrayItem <= LEN(aCurDoc)
IF ASCAN(aCurDoc[nArrayItem], " $CLASSDOC$") > 0
cDocType := "Class"
nClassNamePos := ASCAN(aCurDoc[nArrayItem], " $CLASS$", ASCAN(aCurDoc[nArrayItem], " $CLASSDOC$") + 1) + 1
cFileName := aCurDoc[nArrayItem][nClassNamePos]
ELSEIF ASCAN(aCurDoc[nArrayItem], " $DOC$") > 0
cDocType := "Function"
nFunctionNamePos := ASCAN(aCurDoc[nArrayItem], " $FUNCNAME$") + 1
cFileName := aCurDoc[nArrayItem][nFunctionNamePos]
ELSE
LOOP
ENDIF
// Check whether the function name has "FT_" in it, if so, ignore the first three characters
IF AT("FT_", cFileName) > 0
cTemp := UPPER(SUBSTR(cFileName, 4))
ELSE
cTemp := UPPER(cFileName)
ENDIF
// Check whether the function name has "(" in it, if so, ignore it + the following chars
IF (nEnd := AT("(", cTemp)) > 0
cTemp := LEFT(cTemp, nEnd - 1)
ENDIF
// Strip off any other non-alphabetical or -numeric characters
cFileName := ""
FOR j := 1 TO LEN( cTemp )
cChar := SUBSTR( cTemp, j, 1 )
IF ( cChar >= "0" .AND. cChar <= "9" ) .OR. ( cChar >= "A" .AND. cChar <= "Z" ) .OR. cChar = "_"
cFileName += cChar
ENDIF
NEXT
// Check whether the file name already exists, if so, modify the name
cFileName := LEFT(cFileName, 36)
nEnd := 1
nCount := 0
DO WHILE nEnd > 0
nEnd := ASCAN(aDocInfo, { | a | a[ 2 ] == cFileName + ".htm" })
IF nEnd > 0
IF LEN( cFileName ) = 36
cFileName := STUFF( cFileName, 36, 1, STR( nCount, 1, 0 ) )
ELSE
cFileName = cFileName + STR( nCount, 1, 0 )
ENDIF
nCount ++
ENDIF
ENDDO
// Add the file extension
cFileName := LEFT( cFileName, 36 ) + ".htm"
oHtmClass := THTML():New( 'htm\' + cFileName )
// If file creation was successful
IF oHtmClass:nHandle > 0
// Add a title to the HTML
nPropertyListAnker := .F.
nMethodListAnker := .F.
oHtmClass:WriteText("<title>Harbour - Reference Guide</title>")
// Add CSS to the HTML
oHtmClass:WriteText("<style>")
oHtmClass:WriteText("body {font-family:arial;font-size:14px;line-height:18px;}")
oHtmClass:WriteText(".classtitle {font-weight:bold;font-size:22px;padding-bottom:4px;}")
oHtmClass:WriteText(".oneliner {font-style:italic;margin-bottom:12px;}")
oHtmClass:WriteText(".itemtitle {font-weight:bold;margin-left:8px;padding-bottom:2px;}")
oHtmClass:WriteText(".itemtext {margin-left:20px;padding-bottom:6px;}")
oHtmClass:WriteText("</style></head><body>")
// Loop through the first array (list with arrays)
DO WHILE nArrayItem <= LEN(aCurDoc)
nSubArrayItem := 1
IF cDocType = "Class"
// Loop through the second array (list with methods, properties, ...)
IF ASCAN(aCurDoc[nArrayItem], " $CLASS$") > 0
// Write class name
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "CLASS" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClass:WriteText("<div class='classtitle'>Class " + cTempString + "</div>")
// Add classname and filename to the docinfo array
AADD( aDocInfo, { cTempString, cFileName, "C1" } )
// Write oneliner
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "ONELINER" $ UPPER(a)}) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClass:WriteText("<div class='oneliner'>" + cTempString + "</div>")
// Write inheritance
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "INHERITS" $ UPPER(a)}) + 1
IF nArrayItemLine - 1 <> 0 .AND. !EMPTY(aCurDoc[nArrayItem][nArrayItemLine]) //.AND. FILE(aCurDoc[nArrayItem][nArrayItemLine] + ".txt")
cInherits := aCurDoc[nArrayItem][nArrayItemLine]
cTempString := "<a href='" + cInherits + ".htm'>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine]) + "</a>"
ELSE
cTempString := "-"
ENDIF
oHtmClass:WriteText("<div class='itemtitle'>&raquo; " + "Inherits" + "</div>")
oHtmClass:WriteText("<div class='itemtext'>" + cTempString + "</div>")
WriteClass("Constructor", "Constructor")
WriteClass("Syntax", "Syntax")
WriteClass("Arguments", "Arguments")
WriteClass("Returns", "Returns")
WriteClassDataMethod("Method", "Methods", nArrayItem, nArrayItemLine)
WriteClassDataMethod("Data", "Properties", nArrayItem, nArrayItemLine)
WriteClass("Category", "Category")
WriteClass("Description", "Description")
WriteClass("Seealso", "See also")
oHtmClass:WriteText("</body></html>")
// Create new HTML for the properties and methods
IF LEN(aCurDoc) > 1
cFileName := LEFT(cFileName, LEN(cFileName) - 4) + "_content.htm"
oHtmClassContent := THTML():New( 'htm\' + cFileName )
IF oHtmClassContent:nHandle > 0
// Add a title to the HTML
oHtmClassContent:WriteText("<title>Harbour - Reference Guide</title>")
// Add CSS to the HTML
oHtmClassContent:WriteText("<style>")
oHtmClassContent:WriteText("body {font-family:arial;font-size:14px;line-height:18px;}")
oHtmClassContent:WriteText(".classtitle {font-weight:bold;font-size:22px;padding-bottom:4px;}")
oHtmClassContent:WriteText(".title {font-weight:bold;font-size:18px;padding-bottom:2px;padding-top:8px;}")
oHtmClassContent:WriteText(".oneliner {font-style:italic;margin-bottom:8px;}")
oHtmClassContent:WriteText(".itemtitle {font-weight:bold;margin-left:8px;padding-bottom:2px;}")
oHtmClassContent:WriteText(".itemtext {margin-left:20px;padding-bottom:6px;}")
oHtmClassContent:WriteText("</style></head><body>")
// Write class name
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "CLASS" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClassContent:WriteText("<div class='classtitle'>Class " + cTempString + "</div>")
ENDIF
ENDIF
ELSEIF ASCAN(aCurDoc[nArrayItem], " $DATA$") > 0
IF oHtmClassContent:nHandle > 0
// Write property name
IF nPropertyListAnker = .F.
oHtmClassContent:WriteText("<a name='propertylist'>")
nPropertyListAnker = .t.
ENDIF
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "$DATA$" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClassContent:WriteText("<div class='title'><a name='" + cTempString + "'>Property " + cTempString + "</a></div>")
// Write property oneliner
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "ONELINER" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClassContent:WriteText("<div class='oneliner'>" + cTempString + "</div>")
WriteData("Datatype", "Property type")
WriteData("Category", "Category")
WriteData("Description", "Description")
ENDIF
ELSEIF ASCAN(aCurDoc[nArrayItem], " $METHOD$") > 0
IF oHtmClassContent:nHandle > 0
// Write method name
IF nMethodListAnker = .F.
oHtmClassContent:WriteText("<a name='methodlist'>")
nMethodListAnker = .t.
ENDIF
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "METHOD" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClassContent:WriteText("<div class='title'><a name='" + cTempString + "'>Method " + cTempString + "</a></div>")
// Write method oneliner
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "ONELINER" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClassContent:WriteText("<div class='oneliner'>" + cTempString + "</div>")
WriteMethod("Syntax", "Syntax")
WriteMethod("Arguments", "Arguments")
WriteMethod("Returns", "Returns")
WriteMethod("Description", "Description")
ENDIF
ELSE
// ...
ENDIF
ELSE
// Write function name
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "FUNCNAME" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClass:WriteText("<div class='classtitle'>Function " + cTempString + "</div>")
// Add function name and filename to the docinfo array
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "CATEGORY" $ UPPER(a)}, 2) + 1
cTempString2 := aCurDoc[nArrayItem][nArrayItemLine]
IF cTempString2 $ "WinAPI"
AADD( aDocInfo, { cTempString, cFileName, "F2" } )
ELSE
AADD( aDocInfo, { cTempString, cFileName, "F1" } )
ENDIF
// Write function oneliner
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| "ONELINER" $ UPPER(a)}, 2) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
oHtmClass:WriteText("<div class='oneliner'>" + cTempString + "</div>")
// Write selected function items
DO WHILE nTemp2 <= LEN(aFunctionItems)
WriteFunction(aFunctionItems[nTemp2][1], aFunctionItems[nTemp2][2])
nTemp2 ++
ENDDO
ENDIF
nArrayItem ++
ENDDO
IF cDocType = "Class"
oHtmClassContent:WriteText("</body></html>")
ELSE
oHtmClass:WriteText("</body></html>")
ENDIF
ELSE
// HTML file could not be created, skip current source file
LOOP
ENDIF
ENDIF
NEXT
RETURN NIL
FUNCTION ReadFromTop2(nh)
LOCAL cBuffer := ''
LOCAL aTempArray := {}
DO WHILE FReadLine(nH, @cBuffer, 4096)
cBuffer := TRIM(SUBSTR(cBuffer, nCommentLen))
AADD(aTempArray, cBuffer)
IF AT(DELIM + "END" + DELIM, cBuffer) > 0
AADD(aCurdoc, aTempArray)
aTempArray := {}
ENDIF
ENDDO
FT_FGOTOP()
RETURN NIL
FUNCTION WriteClass(cItem, cTitle)
LOCAL cTempString
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| UPPER(cItem) $ UPPER(a)}) + 1
IF nArrayItemLine - 1 <> 0
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ELSE
cTempString := "-"
ENDIF
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClass:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClass:WriteText("<div class='itemtext'>" + cTempString + "</div>")
RETURN NIL
FUNCTION WriteClassDataMethod(cItem, cTitle, nArrayItem, nArrayItemLine)
LOCAL nPrevArrayItem := nArrayItem
LOCAL nPrevArrayItemLine := nArrayItemLine
LOCAL aTmpArray := {}
LOCAL nTmpCount := 1
LOCAL cTempString
nArrayItem ++
cTempString := ""
DO WHILE nArrayItem <= LEN(aCurDoc)
nArrayItemLine := ASCAN(aCurDoc[nArrayItem], {|a| "$" + UPPER(cItem) + "$" $ UPPER(a)}) + 1
IF nArrayItemLine -1 <> 0
AADD(aTmpArray, {"&bull; <a href='" + LOWER(LEFT(cFileName, LEN(cFileName) - 4)) + "_content.htm#" + aCurDoc[nArrayItem][nArrayItemLine] + "' target=_self>" + aCurDoc[nArrayItem][nArrayItemLine] + "</a><br>", aCurDoc[nArrayItem][nArrayItemLine]})
nTmpCount ++
ENDIF
nArrayItem ++
ENDDO
ASORT(aTmpArray,,, {|x, y| UPPER(x[2]) < UPPER(y[2])})
FOR nTmpCount := 1 TO LEN(aTmpArray)
cTempString = cTempString + aTmpArray[nTmpCount][1]
NEXT
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClass:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClass:WriteText("<div class='itemtext'>" + cTempString + "</div>")
nArrayItem = nPrevArrayItem
nArrayItemLine = nPrevArrayItemLine
LinkInheritance(cItem)
RETURN NIL
FUNCTION LinkInheritance(cItem)
LOCAL nTemp1 := 1
DO WHILE nTemp1 <= LEN(aDirList)
IF UPPER(aDirList[nTemp1][1]) = UPPER(cInherits + ".TXT")
oHtmClass:WriteText("<div class='itemtext'>&bull; <a href='" + cInherits + "_content.htm#" + IIF(UPPER(cItem) = "DATA", "propertylist", "methodlist") + "' target=_self>" + IIF(cItem ="Data", "Properties", "Methods") + " inherited via " + cInherits + "</a></div>")
ENDIF
nTemp1 ++
ENDDO
RETURN NIL
FUNCTION WriteData(cItem, cTitle)
LOCAL cTempString
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| UPPER(cItem) $ UPPER(a)}) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClassContent:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClassContent:WriteText("<div class='itemtext'>" + cTempString + "</div>")
RETURN NIL
FUNCTION WriteMethod(cItem, cTitle)
LOCAL cTempString
nArrayItemLine = ASCAN(aCurDoc[nArrayItem], {|a| UPPER(cItem) $ UPPER(a)}) + 1
cTempString := HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClassContent:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClassContent:WriteText("<div class='itemtext'>" + cTempString + "</div>")
RETURN NIL
FUNCTION WriteFunction(cItem, cTitle)
LOCAL cTempString
nArrayItemLine := ASCAN(aCurDoc[nArrayItem], {|a| UPPER(cItem) $ UPPER(a)}) + 1
cTempString := aCurDoc[nArrayItem][nArrayItemLine]
DO WHILE "$" $ aCurDoc[nArrayItem][nArrayItemLine + 1] = .F.
nArrayItemLine ++
cTempString = cTempString + "<br>" + HTMFormat(aCurDoc[nArrayItem][nArrayItemLine])
ENDDO
IF EMPTY(cTempString)
cTempString := "-"
ENDIF
oHtmClass:WriteText("<div class='itemtitle'>&raquo; " + cTitle + "</div>")
oHtmClass:WriteText("<div class='itemtext'>" + cTempString + "</div>")
RETURN NIL
FUNCTION HTMFormat(cTempString)
LOCAL cTmpString1 := cTempString
LOCAL cTmpString2 := ""
LOCAL nTmpCount := 1
LOCAL cTmpChar
DO WHILE nTmpCount <= LEN(cTmpString1)
cTmpChar := SUBSTR(cTmpString1, nTmpCount, 1)
DO CASE
CASE cTmpChar = "<"
cTmpString2 = cTmpString2 + "&lt;"
CASE cTmpChar = ">"
cTmpString2 = cTmpString2 + "&gt;"
OTHERWISE
cTmpString2 = cTmpString2 + cTmpChar
ENDCASE
nTmpCount ++
ENDDO
RETURN cTmpString2
/***********************************
* Function ProcWwwBuf(cBuffer) -> cTemp
* Parameter cBuffer -> Strip the "<" and ">" symbols from the imput String
@@ -928,7 +1406,7 @@ RETURN nil
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
FUNCTION FormatHtmBuff( cBuffer, cStyle, oHtm )
FUNCTION FormatHtmBuff( cBuffer, cStyle )
LOCAL creturn := ''
LOCAL cline := ''
@@ -937,9 +1415,6 @@ FUNCTION FormatHtmBuff( cBuffer, cStyle, oHtm )
LOCAL lEndBuffer := .f.
LOCAL lArgBold := .f.
LOCAL npos
HB_SYMBOL_UNUSED( oHtm )
creturn := cBuffer + ' '
IF AT( '</par>', creturn ) > 0 .OR. EMPTY( cBuffer )
IF EMPTY( cbuffer )
@@ -1095,7 +1570,7 @@ RETURN cbuffer
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
FUNCTION ProchtmDesc( cBuffer, oHtm, cStyle )
FUNCTION ProchtmDesc( cBuffer, oHtm, cStyle ,cFileName)
LOCAL cOldLine := ''
LOCAL npos
@@ -1112,8 +1587,13 @@ FUNCTION ProchtmDesc( cBuffer, oHtm, cStyle )
LOCAL LFstTableItem := .T.
LOCAL lEndTable := .F.
LOCAL lEndBuffer := .f.
DEFAULT cStyle TO "Default"
DEFAULT cStyle TO "Default"
DEFAULT cFileName TO NIL
iF cStyle == "Syntax"
// tracelog('cBuffer',cBuffer)
clastBuffer += cBuffer
endif
IF AT( '<par>', cBuffer ) == 0 .AND. !EMPTY( cBuffer ) .AND. cstyle <> "Example"
cBuffer := '<par>' + cBuffer
ENDIF
@@ -1151,7 +1631,7 @@ FUNCTION ProchtmDesc( cBuffer, oHtm, cStyle )
cbuffer := cReturn
ENDIF
ELSE
cBuffer := FormathtmBuff( cBuffer, cStyle, oHtm )
cBuffer := FormathtmBuff( cBuffer, cStyle )
ENDIF
ENDIF
ENDIF
@@ -1201,6 +1681,13 @@ FUNCTION ProchtmDesc( cBuffer, oHtm, cStyle )
IF !EMPTY( cBuffer )
// cBuffer:=SUBSTR(cBuffer,2)
cBuffeR := ALLTRIM( cBuffer )
cLastText += cBuffer
if At("->" ,clastBuffer) >0
aadd(aDocWwwInfo, { cLastText,cFileName})
clastBuffer:=""
cLastText:=""
endif
// tracelog(cLastBuffer)
oHtm:WritePar( cBuffer )
ENDIF
@@ -1375,16 +1862,16 @@ FUNCTION GenhtmTable( oHtm )
LOCAL x
/* oHtm:WriteText( "<br>" )
oHtm:WriteText( "<br>" )*/
oHtm:WriteText( '<table border=1>' ) //-4
oHtm:WriteText( '<table border=1 aling=center>' ) //-4
FOR x := 1 TO LEN( asitable )
IF !EMPTY( asitable[ x ] )
IF nNumTableItems == 2
oHtm:WriteText( '<tr><td>' + afitable[ x ] + '</td><td>' + asitable[ x ] + '</td></tr> ' )
oHtm:WriteText( '<tr aling=center ><td>' + afitable[ x ] + '</td><td>' + asitable[ x ] + '</td></tr> ' )
ELSEIF nNumTableItems == 3
oHtm:WriteText( '<tr><td>' + afitable[ x ] + '</td><td>' + asitable[ x ] + '</td><td>' + atitable[ x ] + '</td></tr> ' )
oHtm:WriteText( '<tr aling=center><td>' + afitable[ x ] + '</td><td>' + asitable[ x ] + '</td><td>' + atitable[ x ] + '</td></tr> ' )
ELSEIF nNumTableItems == 4
oHtm:WriteText( '<tr><td>' + afitable[ x ] + '</td><td>' + asitable[ x ] + '</td><td>' + atitable[ x ] + '</td><td>' + afoitable[ x ] + '</td></tr> ' )
oHtm:WriteText( '<tr aling=center><td>' + afitable[ x ] + '</td><td>' + asitable[ x ] + '</td><td>' + atitable[ x ] + '</td><td>' + afoitable[ x ] + '</td></tr> ' )
ENDIF
ELSE
oHtm:WriteText( '<tr><td></td></tr> ' )
@@ -1435,12 +1922,9 @@ STATIC FUNCTION GetItem( cItem, nCurdoc )
LOCAL nPos
LOCAL cCuritem
LOCAL lReturn:=.F.
LOCAL lReturn
LOCAL xPos
if nCurdoc <= len(aCurdoc)
xPos := aCurdoc[ nCurdoc ]
endif
xPos := aCurdoc[ nCurdoc ]
nPos := ASCAN( xPos, { | x | UPPER( ALLTRIM( x ) ) == UPPER( ALLTRIM( cItem ) ) } )
IF nPos > 0
cCuritem := xPos[ nPos ]
@@ -1452,8 +1936,9 @@ STATIC FUNCTION GetItem( cItem, nCurdoc )
ENDIF
RETURN lReturn
#ifdef GAUGE
function CountDocs(aCurDoc)
return len(aCurdoc)
#endif
*+ EOF: GENNG.PRG
*+ EOF: GENNG.PRG

View File

@@ -4,7 +4,7 @@
/*
* Harbour Project source code:
* GENNG support module for hbdoc document Extractor
* GENNG support module for hbdoc document Extractor
*
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
* www - http://www.harbour-project.org
@@ -175,8 +175,8 @@ FUNCTION ProcessiNg()
// Entry Point
//
// Put up information labels
@ INFILELINE, 20 SAY "Extracting: "
@ MODULELINE, 20 SAY "Documenting: "
@ INFILELINE, 20 SAY "Extracting: "
@ MODULELINE, 20 SAY "Documenting: "
// loop through all of the files
FOR i := 1 TO nFiles
@@ -187,16 +187,16 @@ FUNCTION ProcessiNg()
nCommentLen := IIF( AT( ".ASM", UPPER( aDirList[ i, F_NAME ] ) ) > 0, 2, 4 )
nReadHandle := FT_FUSE( aDirList[ i, F_NAME ] )
@ INFILELINE, 33 CLEAR TO INFILELINE, MAXCOL()
@ INFILELINE, 33 SAY PAD( aDirList[ i, F_NAME ], 47 )
@ INFILELINE, 33 SAY PAD( aDirList[ i, F_NAME ], 47 )
@ MODULELINE, 33 CLEAR TO LINELINE, MAXCOL()
@ LINELINE, 27 SAY "Line:"
@ LINELINE, 27 SAY "Line:"
nLineCnt := 0
IF nReadHandle < 0
WRITE_ERROR( "Can't open file: (Dos Error " + STR( FERROR() ) + ")",,,, aDirList[ i, F_NAME ] )
@ ERRORLINE, 0 CLEAR TO ERRORLINE, MAXCOL()
@ ERRORLINE, 20 SAY "Can't open file: (Dos Error " + STR( FERROR() ) + ") File=" + aDirList[ i, F_NAME ]
@ ERRORLINE, 20 SAY "Can't open file: (Dos Error " + STR( FERROR() ) + ") File=" + aDirList[ i, F_NAME ]
LOOP
ENDIF
lEof := .F.
@@ -211,7 +211,7 @@ FUNCTION ProcessiNg()
cBuffer := STRTRAN( cBuffer, CHR( 10 ), "" )
nLineCnt ++
IF nLineCnt % 10 = 0
@ LINELINE, 33 SAY STR( nLineCnt, 5, 0 )
@ LINELINE, 33 SAY STR( nLineCnt, 5, 0 )
ENDIF
// check to see if we are in doc mode or getting out of doc mode
@@ -274,9 +274,9 @@ FUNCTION ProcessiNg()
cBuffer := ReadLN( @lEof )
nLineCnt ++
// Save the function name
cFuncName := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
cFuncName := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
@ MODULELINE, 33 CLEAR TO MODULELINE, MAXCOL()
@ MODULELINE, 33 SAY cFuncName
@ MODULELINE, 33 SAY cFuncName
nMode := D_NORMAL
@@ -342,9 +342,9 @@ FUNCTION ProcessiNg()
cBuffer := ReadLN( @lEof )
nLineCnt ++
// Save the function name
cFuncName := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
cFuncName := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
@ MODULELINE, 33 CLEAR TO MODULELINE, MAXCOL()
@ MODULELINE, 33 SAY cFuncName
@ MODULELINE, 33 SAY cFuncName
nMode := D_NORMAL
// endif
@@ -352,7 +352,7 @@ FUNCTION ProcessiNg()
cBuffer := ReadLN( @lEof )
nLineCnt ++
// get the category
cCategory := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
cCategory := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
// 3) One line description
@@ -730,12 +730,12 @@ FUNCTION ProcNgiInput()
FT_FUSE()
NEXT
@ INFILELINE, 21 SAY "Extracting: "
@ INFILELINE, 21 SAY "Extracting: "
FOR x := 1 TO LEN( afuncsam )
cFile := afuncsam[ x ]
@ INFILELINE, 33 SAY PAD( cfile, 47 )
@ INFILELINE, 33 SAY PAD( cfile, 47 )
FT_FUSE( "ngi\" + cFile )
aAlso := {}
@@ -776,7 +776,7 @@ FUNCTION ProcNgiInput()
FOR x := 1 TO LEN( AFUNCSN_ )
cFile := afuncsn_[ x ]
@ INFILELINE, 33 SAY PAD( cfile, 47 )
@ INFILELINE, 33 SAY PAD( cfile, 47 )
FT_FUSE( "ngi\" + cFile )
aAlso := {}
@@ -835,7 +835,7 @@ FUNCTION ProcNgiInput()
.AND. UPPER( LEFT( cFile, AT( '.', cFile ) - 1 ) ) <> "STRONGTYPING";
.AND. UPPER( LEFT( cFile, AT( '.', cFile ) - 1 ) ) <> "THEGARBAGECOLLECTOR" ;
.AND. UPPER( LEFT( cFile, AT( '.', cFile ) - 1 ) ) <> "THEIDLESTATES"
@ INFILELINE, 33 SAY PAD( cfile, 47 )
@ INFILELINE, 33 SAY PAD( cfile, 47 )
FT_FUSE( "ngi\" + acfiles[ x ] )
aAlso := {}
@@ -970,7 +970,6 @@ FUNCTION GenNgTable( oNgi )
LOCAL nSpace4
LOCAL aLensTItem := {}
LOCAL aLensfoItem := {}
FOR X := 1 TO LEN( afitable )
IF !EMPTY( afiTable[ x ] )
AADD( aLensFItem, LEN( afiTable[ x ] ) )
@@ -1327,7 +1326,7 @@ FUNCTION ProcNGDesc( cBuffer, oNgi, cStyle )
cbuffer := cReturn
ENDIF
ELSE
cBuffer := FormatngBuff( cBuffer, cStyle, ongi )
cBuffer := FormatngBuff( cBuffer, cStyle )
ENDIF
ENDIF
ENDIF
@@ -1560,7 +1559,7 @@ RETURN nil
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
FUNC checkngcolor( cbuffer, ncolorpos )
FUNCTION checkngcolor( cbuffer, ncolorpos )
LOCAL ncolorend
LOCAL nreturn
@@ -1621,7 +1620,7 @@ RETURN max
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
FUNCTION FormatNgBuff( cBuffer, cStyle, ongi )
FUNCTION FormatNgBuff( cBuffer, cStyle )
LOCAL cReturn := ''
LOCAL cLine := ''
@@ -1629,11 +1628,9 @@ FUNCTION FormatNgBuff( cBuffer, cStyle, ongi )
LOCAL cBuffEnd := ''
LOCAL lEndBuffer := .f.
LOCAL nPos
LOCAL lArgBold := .f.
LOCAL LFstTableItem := .t.
HB_SYMBOL_UNUSED( ongi )
cReturn := cBuffer + ' '
IF AT( '</par>', cReturn ) > 0 .OR. EMPTY( cBuffer )
IF EMPTY( cbuffer )
@@ -1731,7 +1728,6 @@ STATIC FUNCTION ReadFromTop( nh )
LOCAL cEnd := DELIM + "END" + DELIM // END keyword
LOCAL cClassDoc := DELIM + "CLASSDOC" + DELIM
LOCAL cBuffer := ''
LOCAL NPOS := 0
LOCAL aLocDoc := {}
DO WHILE FREADline( nH, @cBuffer, 4096 )
cBuffer := TRIM( SUBSTR( cBuffer, nCommentLen ) )
@@ -1773,4 +1769,4 @@ STATIC FUNCTION GetItem( cItem, nCurdoc )
ENDIF
RETURN lReturn
*+ EOF: GENNG.PRG
*+ EOF: GENNG.PRG

View File

@@ -732,18 +732,17 @@ RETURN aAlso
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
FUNCTION Formatos2Buff( cBuffer, cStyle, ongi )
FUNCTION Formatos2Buff( cBuffer, cStyle )
LOCAL cReturn := ''
LOCAL cLine := ''
LOCAL cBuffend := ''
LOCAL coline := ''
LOCAL lEndBuff := .f.
LOCAL nPos
LOCAL lArgBold := .f.
HB_SYMBOL_UNUSED( ongi )
cReturn := cBuffer + ' '
IF AT( '</par>', cReturn ) > 0 .OR. EMPTY( cBuffer )
IF EMPTY( cbuffer )
@@ -834,7 +833,7 @@ RETURN cReturn
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
FUNC checkos2color( cbuffer, ncolorpos )
FUNCTION checkos2color( cbuffer, ncolorpos )
LOCAL ncolorend
LOCAL nreturn
@@ -967,6 +966,7 @@ RETURN max
FUNCTION Genos2Table( oOs2 )
Local x
Local cItem,cItem1
//Local cItem2,cItem3 // Variables not used in function, it may be deleted?
// oos2:WritePar( "" )
if nNumTableItems == 2
citem := str(maxos2elem(afitable),2)
@@ -1080,7 +1080,7 @@ FUNCTION Procos2Desc( cBuffer, oOs2, cStyle )
ENDIF
ELSE
cBuffer := Formatos2Buff( cBuffer, cStyle, oOs2 )
cBuffer := Formatos2Buff( cBuffer, cStyle )
ENDIF
ENDIF
ENDIF
@@ -1317,4 +1317,4 @@ STATIC FUNCTION GetItem( cItem, nCurdoc )
ENDIF
RETURN lReturn
*+ EOF: GENOS2.PRG
*+ EOF: GENOS2.PRG

View File

@@ -63,6 +63,9 @@
#define ERRORLINE 20
#define LONGLINE 600
#define LONGONELINE 66
#define a4_width 595.0
#define a4_height 842.0
MEMVAR aDirlist
MEMVAR aDocInfo,awww,aResult
STATIC aAlso
@@ -186,12 +189,13 @@ local hhh
// loop through all of the files
if lmemory
// oPdf := tPdf():new( "pdf\temp.pdf" )
HB_PDFNEW("pdf\temp.pdf")
HB_PDFNEW("pdf\temp.pdf",,a4_height,a4_width)
hb_pdfnewpage("Harbour Guide",'Harbour Guide')
hb_pdfendpage()
else
// ? 'im here'
HB_PDFNEW("pdf\harbour.pdf")
HB_PDFNEW("pdf\harbour.pdf",,a4_height,a4_width)
hb_pdfnewpage("Harbour Guide",'Harbour Guide')
hb_pdfinitbook(aResult)
hb_pdfendpage()
@@ -832,7 +836,7 @@ FUNCTION ProcPdfTable( cBuffer, nNum )
cBuffer := STRTRAN( cbuffer, "<color:", "" )
cBuffer := STRTRAN( cbuffer, ">", "" )
cBuffer := STRTRAN( cBuffer, ccolor, '' )
nColorpos := ASCAN( aColorTable, { | x | UPPER( x[ 1 ] ) == UPPER( ccolor ) } )
nColorpos := ASCAN( aColorTable, { | x, y | UPPER( x[ 1 ] ) == UPPER( ccolor ) } )
cColor := aColortable[ nColorPos, 2 ]
ENDIF
IF !EMPTY( cBuffer )
@@ -1208,7 +1212,7 @@ FUNC CheckPdfColor( cbuffer, ncolorpos )
cOldColorString := SUBSTR( cbuffer, ncolorpos )
nColorend := AT( ">", cOldColorString )
cOldColorString := SUBSTR( cOldColorString, 1, nColorEnd )
nreturn := ASCAN( acolortable, { | x | UPPER( x[ 1 ] ) == UPPER( ccolor ) } )
nreturn := ASCAN( acolortable, { | x, y | UPPER( x[ 1 ] ) == UPPER( ccolor ) } )
IF nreturn > 0
cReturn := "^a" + acolortable[ nreturn, 2 ]
ENDIF

View File

@@ -4,7 +4,7 @@
/*
* Harbour Project source code:
* GENRTF support module for hbdoc document Extractor
* GENRTF support module for hbdoc document Extractor
*
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
* www - http://www.harbour-project.org
@@ -113,7 +113,7 @@ FUNCTION ProcessRtf()
LOCAL xAddBlank
LOCAL nNumTopics := 0
LOCAL nCurTopics := 1
LOCAL cBar := " " + Replicate( ')', 80 )
LOCAL cBar := " " + replicate( ')', 80 )
LOCAL nMode
LOCAL cFuncName
LOCAL cOneLine
@@ -179,10 +179,10 @@ FUNCTION ProcessRtf()
// Entry Point
//
// Put up information labels
@ INFILELINE, 20 SAY "Extracting: "
@ MODULELINE, 20 SAY "Documenting: "
@ INFILELINE, 20 SAY "Extracting: "
@ MODULELINE, 20 SAY "Documenting: "
// loop through all of the files
oRtf := tRtf():new( "rtf\Harbour.rtf" ):WriteHeader()
oRtf := tRtf():new( "rtf\harbour.rtf" ):WriteHeader()
FOR i := 1 TO nFiles
// Open file for input
@@ -190,16 +190,16 @@ FUNCTION ProcessRtf()
nCommentLen := IIF( AT( ".ASM", UPPER( aDirList[ i, F_NAME ] ) ) > 0, 2, 4 )
nReadHandle := FT_FUSE( aDirList[ i, F_NAME ] )
@ INFILELINE, 33 CLEAR TO INFILELINE, MAXCOL()
@ INFILELINE, 33 SAY PAD( aDirList[ i, F_NAME ], 47 )
@ INFILELINE, 33 SAY PAD( aDirList[ i, F_NAME ], 47 )
@ MODULELINE, 33 CLEAR TO LINELINE, MAXCOL()
@ LINELINE, 27 SAY "Line:"
@ LINELINE, 27 SAY "Line:"
nLineCnt := 0
IF nReadHandle < 0
WRITE_ERROR( "Can't open file: (Dos Error " + STR( FERROR() ) + ")",,,, aDirList[ i, F_NAME ] )
@ ERRORLINE, 0 CLEAR TO ERRORLINE, MAXCOL()
@ ERRORLINE, 20 SAY "Can't open file: (Dos Error " + STR( FERROR() ) + ") File=" + aDirList[ i, F_NAME ]
@ ERRORLINE, 20 SAY "Can't open file: (Dos Error " + STR( FERROR() ) + ") File=" + aDirList[ i, F_NAME ]
LOOP
ENDIF
lEof := .F.
@@ -216,7 +216,7 @@ FUNCTION ProcessRtf()
cBuffer := TRIM( SUBSTR( ReadLN( @lEof ), nCommentLen ) )
nLineCnt ++
IF nLineCnt % 10 = 0
@ LINELINE, 33 SAY STR( nLineCnt, 5, 0 )
@ LINELINE, 33 SAY STR( nLineCnt, 5, 0 )
ENDIF
// check to see if we are in doc mode or getting out of doc mode
@@ -261,7 +261,7 @@ FUNCTION ProcessRtf()
// oRtf:WriteKLink(aAlso,.f.)
// else
oRtf:WriteKLink(aAlso)
// endif
// endif
ENDIF
lDoc := .F.
@@ -279,9 +279,9 @@ FUNCTION ProcessRtf()
cBuffer := ReadLN( @lEof )
nLineCnt ++
// Save the function name
cFuncName := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
cFuncName := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
@ MODULELINE, 33 CLEAR TO MODULELINE, MAXCOL()
@ MODULELINE, 33 SAY cFuncName
@ MODULELINE, 33 SAY cFuncName
nMode := D_NORMAL
@@ -345,9 +345,9 @@ FUNCTION ProcessRtf()
cBuffer := ReadLN( @lEof )
nLineCnt ++
// Save the function name
cFuncName := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
cFuncName := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
@ MODULELINE, 33 CLEAR TO MODULELINE, MAXCOL()
@ MODULELINE, 33 SAY cFuncName
@ MODULELINE, 33 SAY cFuncName
nMode := D_NORMAL
@@ -358,7 +358,7 @@ FUNCTION ProcessRtf()
cBuffer := ReadLN( @lEof )
nLineCnt ++
// get the category
cCategory := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
cCategory := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) )
// 3) One line description
@@ -734,7 +734,7 @@ oRtf:WritePar( "" ) //:endpar()
NEXT
ortf:close()
RETURN NIL
RETURN oRtf:aIdh
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
@@ -876,6 +876,10 @@ FUNCTION ProcRTFDesc( cBuffer, oRtf, cStyle )
nPos := AT( " ", cReturn )
cOLine := LEFT( cReturn, nPos - 1 )
cReturn := STRTRAN( cReturn, coLine, "" )
if "\" $ cReturn
cReturn := Strtran( cReturn, '\', '\\')
// tracelog( cReturn )
endif
IF AT( "@", cOLine ) > 0 .OR. AT( "()", cOLine ) > 0 .OR. AT( "<", cOLine ) > 0 .OR. AT( "_", cOLine ) > 0
lArgBold := .T.
ELSE
@@ -893,12 +897,17 @@ FUNCTION ProcRTFDesc( cBuffer, oRtf, cStyle )
ENDIF
ELSE
cBuffer := FormatrtfBuff( cBuffer, cStyle, ortf )
cBuffer := FormatrtfBuff( cBuffer, cStyle )
ENDIF
ENDIF
ENDIF
IF AT( '<par>', cBuffer ) > 0 .AND. AT( '</par>', cBuffer ) > 0
if "\" $ cBuffer
cBuffer := Strtran(cBuffer, '\', '\\')
// tracelog( cBuffer )
endif
cBuffer := STRTRAN( cBuffer, '<par>', '' )
cBuffer := STRTRAN( cBuffer, '<b>', '\b ' )
cBuffer := STRTRAN( cBuffer, '</b>', '\b0 ' )
@@ -1052,7 +1061,7 @@ FUNCTION GenRtfTable( oRtf )
LOCAL x
LOCAL lCar := .f.
LOCAL nMax2
LOCAL nPos2
LOCAL nPos2
LOCAL nPos
LOCAL aLensFItem := {}
LOCAL aLensSItem := {}
@@ -1072,11 +1081,11 @@ FUNCTION GenRtfTable( oRtf )
nPos := maxrtfelem( afitable )
nPos2 := ASCAN( alensfitem, { | x | x == nPos } )
oRtf:WriteParBox( " " + Replicate( CHR( 196 ), 80 ) )
oRtf:WriteParBox( " " + replicate( CHR( 196 ), 80 ) )
FOR x := 1 TO LEN( afiTable )
ortf:WriteParFixed( IF( AT( "|", afiTable[ x ] ) > 0, STRTRAN( afiTable[ x ], "|", " " ), afiTable[ x ] ), '\fi-426\li426' )
NEXT
oRtf:WriteParBox( " " + Replicate( CHR( 196 ), 80 ) )
oRtf:WriteParBox( " " + replicate( CHR( 196 ), 80 ) )
// oRtf:WritePar( "" )
afiTable := {}
@@ -1152,7 +1161,7 @@ RETURN max
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
FUNCTION FormatrtfBuff( cBuffer, cStyle, ongi )
FUNCTION FormatrtfBuff( cBuffer, cStyle )
LOCAL cReturn := ''
LOCAL cLine := ''
@@ -1161,9 +1170,6 @@ FUNCTION FormatrtfBuff( cBuffer, cStyle, ongi )
LOCAL lEndBuff := .f.
LOCAL nPos
LOCAL lArgBold := .f.
HB_SYMBOL_UNUSED( ongi )
creturn := cBuffer + ' '
IF AT( '</par>', creturn ) > 0 .OR. EMPTY( cBuffer )
IF EMPTY( cbuffer )
@@ -1308,4 +1314,4 @@ RETURN lReturn
// /
*+ EOF: GENRTF.PRG
*+ EOF: GENRTF.PRG

View File

@@ -57,7 +57,6 @@
#include "directry.ch"
#include "fileio.ch"
#include "inkey.ch"
#include "common.ch"
// output lines on the screen

View File

@@ -1,13 +1,13 @@
/*
* $Id$
* $Id$
*/
/*
* Harbour Project source code:
* xHarbour Project source code:
* HBDOC document Extractor
*
* Copyright 1999-2001 Luiz Rafael Culik <culik@sl.conex.net>
* www - http://www.harbour-project.org
* Copyright 1999-2003 Luiz Rafael Culik <culikr@uol.com.br>
* www - http://www.xharbour.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -128,9 +128,12 @@
// The delimiter
MEMVAR aDirList
MEMVAR aDocInfo
MEMVAR aDocwwwInfo
MEMVAR aClassList
MEMVAR aLinkInfo
MEMVAR aAuthorList
MEMVAR lAscii
MEMVAR lTee
MEMVAR lContinuous
MEMVAR lAuthor
MEMVAR lRtf
@@ -138,11 +141,15 @@ MEMVAR lNgi
MEMVAR lOs2
MEMVAR lPdf
MEMVAR lWww
MEMVAR lWww2
MEMVAR lChm
MEMVAR lChm2
MEMVAR lNorton
MEMVAR aWWW
MEMVAR lTroff
MEMVAR aResult
MEMVAR theHandle
STATIC cTitle:=''
/*
@@ -160,23 +167,39 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
// NG/EH input
LOCAL aExtensions := { "*.ch", "*.prg", "*.c", "*.asm", "*.txt" }
LOCAL i
Local cLast
LOCAL i, j
LOCAL cLast
LOCAL nItem
LOCAL nHpj
LOCAL cItem:=''
LOCAL cFName
LOCAL cLName
LOCAL aName
LOCAL nLen
LOCAL lDone
LOCAL cMI
LOCAL oHtmIndex
LOCAL cFileName
LOCAL cCompiler // Compiler type
LOCAL oHtm
LOCAL oHtm1
LOCAL nPos
LOCAL ppp
LOCAL aMetaContents:={}
Local aTemp:={}
LOCAL lAdded:=.f.
Local aRtfid
LOCAL nCount_1 := 1
LOCAL nCount_2 := 1
PUBLIC theHandle
PUBLIC aDirList
PUBLIC aDocInfo := {}
PUBLIC aDocWwwInfo := {}
PUBLIC aClassList := {}
PUBLIC aLinkInfo := {}
PUBLIC aAuthorList := {}
PUBLIC lAscii := .F. // Create ascii output instead of NG/EH input
@@ -187,10 +210,13 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
PUBLIC lOs2 := .F.
PUBLIC lPdf := .F.
PUBLIC lWww := .F.
PUBLIC lWww2 := .F.
PUBLIC lChm := .F.
PUBLIC lChm2 := .F.
PUBLIC lNorton := .F.
PUBLIC lTee := .F.
PUBLIC aWWW := {}
PUBLIC aResult:={}
PUBLIC aResult := {}
PUBLIC lTroff := .f.
// The following variables are used to allow one to change the delimiter
@@ -208,11 +234,13 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
// See if flag is there
IF .NOT. EMPTY( cFlags )
IF .NOT. EMPTY( cFlags )
IF LEFT( cFlags, 1 ) == "-" .OR. LEFT( cFlags, 1 ) == "/"
IF ( cFlags := UPPER( RIGHT( cFlags, 3 ) ) ) == "TXT"
lAscii := .T.
lContinuous := .F.
ELSEIF cFlags = "TEE"
lTee := .T.
ELSEIF cFlags = "HPC"
lNorton := .T.
ELSEIF cFlags = "NGI"
@@ -223,11 +251,14 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
lRtf := .T.
ELSEIF cFlags = "HTM"
lWww := .T.
ELSEIF cFlags = "HT2"
lWww2 := .T.
ELSEIF cFlags = "PDF"
lPdf := .T.
ELSEIF cFlags = "CHM"
lChm := .T.
ELSEIF cFlags = "CH2"
lChm2 := .T.
ELSEIF cFlags = "TRF"
lTroff := .t.
ELSEIF cFlags = "DOC"
@@ -244,28 +275,31 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
// Get the linkfile name and get the info in it
IF cLinkName = NIL
?? "Harbour Doc Extractor"
? "Copyright 1999-2001, http://www.harbour-project.org"
? ""
? "Syntax: hbdoc [options] <linkname> [<ifile>]"
? ""
? "Options: /txt Create an ASCII file instead of a Norton Guide"
? " /con Create an ASCII file without formfeeds"
? " /hpc Helpc source file"
? " /ngi Adds the -NG switch to EHC command for compile for"
? " DOS/Windows/Linux."
? " /rtf Winhelp source code for Windows"
? " /os2 OS/2 help source code For OS/2"
? " /htm Generate HTML output"
? " /chm Generate HTML source files for Windows .CHM Help files"
? " /pdf Generate an Adobe Portable Document (.PDF)"
? " /trf Gerenate Linux TROFF code"
? " /doc Create continuous ASCII file w/o author information"
? " "
? "Notes: - Only one option can be specified at a time."
? " - <linkname> is the name of the Norton Guide Link file."
? " - <iFile> is a file containing a list of files to process"
? " otherwise *.prg, *.c, *.asm, *.ch and *.txt are used."
outstd( "Harbour Doc Extractor"+ hb_osnewline() )
outstd( "Copyright 1999-2005, http://www.harbour-project.org"+ hb_osnewline() )
outstd( ""+ hb_osnewline() )
outstd( "Syntax: hbdoc [options] <linkname> [<ifile>]"+ hb_osnewline() )
outstd( ""+ hb_osnewline() )
outstd( "Options: /txt Create an ASCII file instead of a Norton Guide"+ hb_osnewline() )
outstd( " /con Create an ASCII file without formfeeds"+ hb_osnewline() )
outstd( " /hpc Helpc source file"+ hb_osnewline() )
outstd( " /ngi Adds the -NG switch to EHC command for compile for"+ hb_osnewline() )
outstd( " DOS/Windows/Linux."+ hb_osnewline() )
outstd( " /rtf Winhelp source code for Windows"+ hb_osnewline() )
outstd( " /os2 OS/2 help source code For OS/2"+ hb_osnewline() )
outstd( " /htm Generate HTML output"+ hb_osnewline() )
outstd( " /ht2 Generate HTML output (new doc model)"+ hb_osnewline() )
outstd( " /chm Generate HTML source files for Windows .chm Help files"+ hb_osnewline() )
outstd( " /ch2 Generate HTML source files for Windows .chm Help files"+ hb_osnewline() )
outstd( " (new doc model)"+ hb_osnewline() )
outstd( " /pdf Generate an Adobe Portable Document (.PDF)"+ hb_osnewline() )
outstd( " /trf Gerenate Linux TROFF code"+ hb_osnewline() )
outstd( " /doc Create continuous ASCII file w/o author information"+ hb_osnewline() )
outstd( " "+ hb_osnewline() )
outstd( "Notes: - Only one option can be specified at a time."+ hb_osnewline() )
outstd( " - <linkname> is the name of the Norton Guide Link file."+ hb_osnewline() )
outstd( " - <iFile> is a file containing a list of files to process"+ hb_osnewline() )
outstd( " otherwise *.prg, *.c, *.asm, *.ch and *.txt are used."+ hb_osnewline() )
RETURN NIL
ENDIF
@@ -297,16 +331,22 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
IF EMPTY( DIRECTORY( "htm.*", "D" ) )
FT_MKDIR( "htm" )
ENDIF
ELSEIF lWww2
IF EMPTY( DIRECTORY( "htm.*", "D" ) )
FT_MKDIR( "htm" )
ENDIF
ELSEIF lChm
IF EMPTY( DIRECTORY( "chm.*", "D" ) )
FT_MKDIR( "chm" )
ENDIF
ELSEIF lChm2
IF EMPTY( DIRECTORY( "chm.*", "D" ) )
FT_MKDIR( "chm" )
ENDIF
ELSEIF lPdf
IF EMPTY( DIRECTORY( "pdf.*", "D" ) )
FT_MKDIR( "pdf" )
ENDIF
ELSEIF lNgi
IF EMPTY( DIRECTORY( "ngi.*", "D" ) )
FT_MKDIR( "ngi" )
@@ -320,10 +360,21 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
IF EMPTY( DIRECTORY( "ipf.*", "D" ) )
FT_MKDIR( "ipf" )
ENDIF
ELSEIF lAscii
IF EMPTY( DIRECTORY( "txt.*", "D" ) )
FT_MKDIR( "txt" )
ENDIF
ELSEIF lTee
IF EMPTY( DIRECTORY( "teesrcs.*", "D" ) )
FT_MKDIR( "teesrcs" )
ENDIF
IF EMPTY( DIRECTORY( "teedocs.*", "D" ) )
FT_MKDIR( "teedocs" )
ENDIF
ENDIF
if lNgi .or. lRtf
cCompiler := fill_Link_info( cLinkName )
endif
endif
IF cAtFile = NIL // use all files in directory
@@ -342,10 +393,13 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
IF lAscii
ASCIIFiles()
ELSEIF lTee
TeeFiles()
ELSEIF lNorton
ProcessFiles()
ELSEIF lRtf
ProcessRtf()
aRtfid := ProcessRtf()
// tracelog(aRtfid,aRtfid[1])
ELSEIF lPdf
#ifdef PDF
ProcessPDF(.t.)
@@ -353,8 +407,12 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
#endif
ELSEIF lWww
ProcessWww()
ELSEIF lWww2
ProcessWww2()
ELSEIF lChm
ProcessChm()
ELSEIF lChm2
ProcessChm2()
ELSEIF lNgi
ProcessiNg()
ELSEIF lTroff
@@ -383,11 +441,16 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
ProcessPDF(.f.)
#endif
ELSEIF lRtf
ProcessRtf()
aRtfid := ProcessRtf()
// tracelog(aRtfid,aRtfid[1])
ELSEIF lWww
ProcessWww()
ELSEIF lWww2
ProcessWww2()
ELSEIF lChm
ProcessChm()
ELSEIF lChm2
ProcessChm2()
ELSEIF lNgi
ProcessiNg()
ELSEIF lTroff
@@ -402,34 +465,36 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
// Now build text files for norton compiler based upon link file
// first sort based upon category and filename. Not Fast but easy.
@ INFILELINE, 0 CLEAR TO INFILELINE, MAXCOL()
@ MODULELINE, 0 CLEAR TO MODULELINE, MAXCOL()
@ LINELINE, 0 CLEAR TO LINELINE, MAXCOL()
@ INFILELINE, 30 SAY "Sorting input files"
@ INFILELINE, 30 SAY "Sorting input files"
ASORT( aDocInfo,,, { | a, b | UPPER( a[ 1 ] + " " + a[ 2 ] ) < UPPER( b[ 1 ] + " " + b[ 2 ] ) } )
// Now actually build the info
@ INFILELINE, 0 CLEAR TO INFILELINE, MAXCOL()
IF lnorton
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "HelpC" ) ;
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "HelpC" ) ;
+ " input files"
ELSEIF lRTF
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "WINHELP" ) ;
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "WINHELP" ) ;
+ " input files"
ELSEIF lPdf
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "Adobe Portable Document Format" ) ;
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "Adobe Portable Document Format" ) ;
+ " input files"
ELSEIF lWww .or. lChm
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "Html" ) ;
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "Html" ) ;
+ " input files"
ELSEIF lNgi
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "NG" ) ;
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "NG" ) ;
+ " input files"
ELSEIF lTroff
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "TROFF" ) ;
@ INFILELINE, 30 SAY "Assembling " + IIF( lAscii, "documentation", "TROFF" ) ;
+ " input files"
ENDIF
@@ -455,11 +520,11 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
IF i = 1 .OR. .NOT. ( ALLTRIM( aDocInfo[ i - 1, 1 ] ) == ALLTRIM( aDocInfo[ i, 1 ] ) )
// Make the first copy
? "ECHO Creating", aLinkinfo[ nItem, 2 ]
? "COPY hdf/" + ALLTRIM( aDocInfo[ i, 4 ] ) + " HarDoc.hdf > NUL"
? "COPY hdf\" + ALLTRIM( aDocInfo[ i, 4 ] ) + " HarDoc.hdf > NUL"
ELSE
// This may be slow but I don't have to worry about line length
? "TYPE hdf/" + ALLTRIM( aDocInfo[ i, 4 ] ) + " >> HarDoc.hdf "
? "TYPE hdf\" + ALLTRIM( aDocInfo[ i, 4 ] ) + " >> HarDoc.hdf "
ENDIF
aLinkInfo[ nItem, 3 ] = .T.
ELSE
@@ -469,7 +534,7 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
SET CONSOLE ON
WRITE_ERROR( "Category not found: " + aDocInfo[ i, 1 ],,,, aDocInfo[ i, 4 ] )
@ ERRORLINE, 0 CLEAR TO ERRORLINE, MAXCOL()
@ ERRORLINE, 20 SAY "Category not found: " + aDocInfo[ i, 1 ] + " in " + aDocInfo[ i, 4 ]
@ ERRORLINE, 20 SAY "Category not found: " + aDocInfo[ i, 1 ] + " in " + aDocInfo[ i, 4 ]
SET ALTERNATE TO "assembl.bat" ADDITIVE
SET ALTERNATE ON
SET CONSOLE OFF
@@ -486,20 +551,32 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
FWRITE( nHpj, 'CONTENTS=IDH_OVERVIEW' + CRLF )
FWRITE( nHpj, 'TITLE='+cTitle + CRLF )
FWRITE( nHpj, 'COPYRIGHT=Harbour (C) http://www.harbour-project.org' + CRLF )
FWRITE( nHpj, 'HLP=./'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hlp"+ CRLF )
FWRITE( nHpj, 'ROOT=/' + CURDIR() + "/RTF" + CRLF )
FWRITE( nHpj, 'CNT=./'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".cnt"+ CRLF )
FWRITE( nHpj, 'HLP=.\'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hlp"+ CRLF )
FWRITE( nHpj, 'ROOT=\' + CURDIR() + "\RTF" + CRLF )
FWRITE( nHpj, 'CNT=.\'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".cnt"+ CRLF )
FWRITE( nHpj, '[FILES]' + CRLF )
FWRITE( nHpj, "harbour.rtf" + CRLF )
FWRITE( nHpj, '[CONFIG]' + CRLF + 'contents()' + CRLF + 'prev()' + CRLF + 'next()' + CRLF + 'BrowseButtons()' + CRLF )
FWRITE( nHpj, '[WINDOWS]' + CRLF + 'Commands="Harbour Commands",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF +'API="Harbour Commands",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF + 'Error="Harbour Run Time Errors",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF + 'Tools="Harbour Tools",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF + 'Class="Harbour OOP Commands",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF + 'Funca="Harbour Run Time Functions A-M",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF + 'Funcn="Harbour Run Time Functions N-_",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF + 'Main="HARBOUR",(117,100,894,873),60672,(r14876671),(r12632256),f2' + CRLF )
FWRITE( nHpj, '[WINDOWS]' + CRLF + 'Commands="Harbour Commands",(653,102,360,600),20736,(r14876671),(r12632256),f2' +;
CRLF +'API="Harbour Commands",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF +;
'Error="Harbour Run Time Errors",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF +;
'Tools="Harbour Tools",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF +;
'Class="Harbour OOP Commands",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF +;
'Funca="Harbour Run Time Functions A-M",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF +;
'Funcn="Harbour Run Time Functions N-_",(653,102,360,600),20736,(r14876671),(r12632256),f2' + CRLF +;
'Main="Harbour",(117,100,894,873),60672,(r14876671),(r12632256),f2' + CRLF )
FWRITE( nHpj, '[MAP]'+CRLF)
for each ppp in aRtfid
fwrite(nHpj, "#define "+ppp[1] +" " + str(ppp[2])+CRLF)
next
FCLOSE( nHpj )
nHpj := FCREATE( lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".cnt" )
FWRITE( nHpj, ':Base '+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hlp"+ CRLF )
FWRITE( nHpj, ':Title '+cTitle+CRLF)
FWRITE( nHpj, ':Index '+lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +'='+lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hlp"+ CRLF )
FWRITE( nHpj, '1 Harbour'+CRLF)
asort(aWww,,,{|x,y| x[3]+x[1]<y[3]+y[1]})
asort( aWww,,,{|x,y| x[3]+x[1]<y[3]+y[1]})
for ppp:=1 to len(aWww)
if aWww[ppp,3]=='Document'
fWrite( nHpj, '2 '+aWww[ppp,1]+"="+aWww[ppp,2]+">Main"+CRLF)
@@ -528,7 +605,7 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
for ppp:=1 to nItem
cLast:=GetNextContent(ppp)
if cLast<>'Run Time Errors' .and. cLast <>"Document" .and. cLast <>"The garbage collector" .and. cLast <>"OOP Command" .and. cLast <>"Command" .and. cLast <>"The idle states"
if cLast =='Statement' .or. cLast =="Command"
WriteContentFile(aWww,cLast,nHpj)
endif
Next
@@ -551,16 +628,18 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
fWrite( nHpj, '2 '+aWww[ppp,1]+"="+aWww[ppp,2]+">API"+CRLF)
endif
Next
fClose(nHpj)
set console off
ELSEIF lWWW
fClose(nHpj)
set console off
ELSEIF lWWW
ASORT( aDocWWWInfo,,, { | a, b | UPPER( a[ 1 ] ) < UPPER( b[ 1 ]) } )
asort(adocinfo,,,{|x,y| x[1]+x[2]<y[1]+y[2]})
do while .t.
citem:=adocinfo[1,1]
AADD(aMetaContents,{"GENERATOR","HBDOC Harbour document Extractor"})
aadd(aMetaContents,{'Keywords',"Harbour project, Clipper, xBase, database, Free Software, GNU, compiler, cross platform, 32-bit, FiveWin,"+cItem})
ohtm:=THTML():new('htm/hb'+strtran(citem," ","")+'.htm',aMetaContents)
ohtm:=THTML():new('htm\hb'+strtran(citem," ","")+'.htm',aMetaContents)
ohtm:WriteText('<h2>'+adocinfo[1,1]+'</h2><br>')
ohtm:WriteText("<table>")
@@ -576,7 +655,7 @@ set console off
AADD(aMetaContents,{"GENERATOR","HBDOC Harbour document Extractor"})
aadd(aMetaContents,{'Keywords',"Harbour project, Clipper, xBase, database, Free Software, GNU, compiler, cross platform, 32-bit, FiveWin,"+cItem})
ohtm:=THTML():new('htm/hb'+strtran(adocinfo[ppp,1]," ","")+'.htm',aMetaContents)
ohtm:=THTML():new('htm\hb'+strtran(adocinfo[ppp,1]," ","")+'.htm',aMetaContents)
// oHtm:WriteMetaTag('Keywords',"Harbour project, Clipper, xBase, database, Free Software, GNU, compiler, cross platform, 32-bit, FiveWin,"+cItem)
ohtm:WriteText('<h2>'+adocinfo[ppp,1]+'</h2><br>')
@@ -594,11 +673,11 @@ set console off
AADD(aMetaContents,{"GENERATOR","HBDOC Harbour document Extractor"})
aadd(aMetaContents,{'Keywords',"Harbour project, Clipper, xBase, database, Free Software, GNU, compiler, cross platform, 32-bit, FiveWin,"+cItem})
oHtm1 := THTML():New( "htm/harbour.htm" ,aMetaContents)
oHtm1 := THTML():New( "htm\harbour.htm" ,aMetaContents)
// oHtm:WriteMetaTag('Keywords',"Harbour project, Clipper, xBase, database, Free Software, GNU, compiler, cross platform, 32-bit, FiveWin,Harbour Documentation")
oHtm1:WriteTitle( "Harbour Reference Guide" )
oHtm1:WriteText( "<H1>Harbour Reference Guide</H1>" )
oHtm1:WriteText( "<H2>HARBOUR</H2>" + hb_osnEwline() + '<UL>' )
oHtm1:WriteText( "<H2>Harbour</H2>" + hb_osnEwline() + '<UL>' )
oHtm1:WriteLink( "overview", UpperLower( "Harbour Read me" ) )
oHtm1:WriteLink( "license", UpperLower( "Harbour License" ) )
oHtm1:WriteLink( "http://www.gnu.org/copyleft/gpl.html", "GNU License" )
@@ -606,6 +685,7 @@ set console off
oHtm1:WriteLink( "harbourextensions.htm", "Harbour Extensions" )
oHtm1:WriteLink( "thegarbagecollector.htm", "The Garbage Collector" )
oHtm1:WriteLink( "theidlestates.htm", "The Idle States" )
ohtm1:WriteLink( "http://www.harbour-project.org","Harbour.org Web page")
oHtm1:WriteText( "</UL>" )
oHtm1:WriteText( "<H2>Alphabetical list of functions by Categorie</H2>" )
ohtm1:writetext('<ul>')
@@ -615,25 +695,110 @@ set console off
for ppp:=1 to nItem
cLast:=GetNextContent(ppp)
if cLast<>'Run Time Errors' .and. cLast <>"Document" .and. cLast <>"The garbage collector" .and. cLast <>"OOP Command" .and. cLast <>"Command" .and. cLast <>"The idle states"
if (cLast<>'Run Time Errors' .and. cLast <>"Document" .and. cLast <>"The garbage collector" .and. cLast <>"The idle states") .and. (cLast != "Command" .and. clast !="OOP Command" .and. cLast !="Statement") .and. (! "CLASS" $ UPPER(cLast) .and. !"METHOD" $ UPPER(cLast))
ohtm1:WriteLink('hb'+strtran(aResult[ppp]," ","")+'.htm',aResult[ppp])
endif
Next
ohtm1:writetext('</ul>')
ohtm1:writetext('</ul>')
oHtm1:WriteText( "<H2>Commands and Statements</H2>" )
ohtm1:writetext('<ul>')
for ppp:=1 to nItem
cLast:=GetNextContent(ppp)
if cLast == "Command" .or. clast =="OOP Command" .or. cLast =="Statement"
ohtm1:WriteLink('hb'+strtran(aResult[ppp]," ","")+'.htm',aResult[ppp])
endif
Next
ohtm1:writetext('</ul>')
oHtm1:WriteText( "<H2>Classes and method </H2>" )
ohtm1:writetext('<ul>')
for ppp:=1 to nItem
cLast:=GetNextContent(ppp)
if "CLASS" $ UPPER(cLast) .or. "METHOD" $ UPPER(cLast)
ohtm1:WriteLink('hb'+strtran(aResult[ppp]," ","")+'.htm',aResult[ppp])
endif
Next
ohtm1:writetext('</ul>')
ohtm1:close()
ohtm1:close()
oHtm:Close()
ohtm:=THTML():new("htm\harbourfuntionwithsyntax.htm",aMetaContents)
For each ppp in aDocwwwInfo
ohtm:Writelink(ppp[2],ppp[1])
next
ohtm:close()
ELSEIF lWww2
cFileName := "index.htm"
oHtmIndex := THTML():New('htm\' + cFileName)
// Add title to HTML
oHtmIndex:WriteText("<title>Harbour - Reference Guide</title>")
// Add CSS to the HTML
oHtmIndex:WriteText("<style>")
oHtmIndex:WriteText("body {font-family:arial;font-size:14px;line-height:18px;}")
oHtmIndex:WriteText(".classtitle {font-weight:bold;font-size:20px;padding-bottom:4px;}")
oHtmIndex:WriteText(".functiontitle {font-weight:bold;font-size:20px;padding-bottom:4px;}")
oHtmIndex:WriteText("</style></head><body>")
oHtmIndex:WriteText("<div style='font-size:20px;font-weight:bold;margin-bottom:16px;'>Harbour Reference Guide</div>")
ASORT(aDocInfo,,, {|x, y| UPPER(x[1]) < UPPER(y[1])})
oHtmIndex:WriteText("<div class='classtitle'>Alphabetical list of classes</div>")
oHtmIndex:WriteText("<div style='margin-left:12px;margin-bottom:12px;'>")
FOR i := 1 TO LEN(aDocInfo)
IF aDocInfo[i][3] = "C1"
oHtmIndex:WriteText("<strong>&raquo;</strong> <a href='" + aDocInfo[i][2] + "' target=_self>" + aDocInfo[i][1] + "</a><br>")
END IF
NEXT
oHtmIndex:WriteText("</div>")
oHtmIndex:WriteText("<div class='functiontitle'>Alphabetical list of functions</div>")
oHtmIndex:WriteText("<div style='margin-left:12px;margin-bottom:12px;'>")
FOR i := 1 TO LEN(aDocInfo)
IF aDocInfo[i][3] = "F1"
oHtmIndex:WriteText("<strong>&raquo;</strong> <a href='" + aDocInfo[i][2] + "' target=_self>" + aDocInfo[i][1] + "</a><br>")
ENDIF
NEXT
oHtmIndex:WriteText("</div>")
oHtmIndex:WriteText("<div class='classtitle'>Alphabetical list of WinAPI functions</div>")
oHtmIndex:WriteText("<div style='margin-left:12px;margin-bottom:12px;'>")
FOR i := 1 TO LEN(aDocInfo)
IF aDocInfo[i][3] = "F2"
oHtmIndex:WriteText("<strong>&raquo;</strong> <a href='" + aDocInfo[i][2] + "' target=_self>" + aDocInfo[i][1] + "</a><br>")
END IF
NEXT
oHtmIndex:WriteText("</div>")
oHtmIndex:WriteText("</html>")
ELSEIF lChm
nHpj := FCREATE( 'chm/'+lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hhp" )
nHpj := FCREATE( 'chm\'+lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hhp" )
FWRITE( nHpj, '[OPTIONS]' + CRLF )
FWRITE( nHpj, 'Compatibility=1.1 or later'+CRLF)
FWRITE( nHpj, 'Auto Index=Yes'+CRLF)
FWRITE( nHpj,'Full-text search=Yes'+CRLF)
FWRITE( nHpj, 'Language=0x416 Português (brasileiro)' + CRLF )
FWRITE( nHpj, 'Contents file=./'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hhc"+ CRLF )
FWRITE( nHpj, 'Compiled file=./'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".chm"+ CRLF )
FWRITE( nHpj, 'Contents file=.\'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hhc"+ CRLF )
FWRITE( nHpj, 'Compiled file=.\'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".chm"+ CRLF )
FWRITE( nHpj, 'Display compile progress=No'+CRLF)
nPos:=aScan(awww,{|x| Upper(x[1])="OVERVIEW"})
if nPos > 0
@@ -649,7 +814,7 @@ set console off
ohtm:=THTML():NewContent('chm/'+lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hhc")
ohtm:=THTML():NewContent('chm\'+lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hhc")
ohtm:WriteText('<!--Sitemap 1.0-->')
ohtm:Addobject("text/site properties")
oHtm:AddParam("FrameName","Ajuda")
@@ -657,7 +822,7 @@ set console off
ohtm:WriteText("<ul>")
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHTm:AddParam('Name','HARBOUR')
oHTm:AddParam('Name','Harbour')
ohtm:EndObject()
ohtm:WriteText("<ul>")
writeChmContentFile(aDocinfo,"Document",oHtm)
@@ -710,7 +875,7 @@ set console off
oHtm:AddObject("text/sitemap")
oHTm:AddParam('Name',cLast)
ohtm:EndObject()
ohtm:WriteText("<ul>")
ohtm:WriteText("<ul>")
endif
if cLast<>'Run Time Errors' .and. cLast <>"Document" .and. cLast <>"The garbage collector" .and. cLast <>"OOP Command" .and. cLast <>"Command" .and. cLast <>"The idle states"
// oHtm:WriteText( "<UL>" )
@@ -753,7 +918,231 @@ set console off
oHtm:WriteText( "</UL>" )
ohtm:WriteText("</ul>")
ohtm:close()
ELSEIF lChm2
cFileName := "index.htm"
oHtmIndex := THTML():New('chm\' + cFileName)
// Add title to HTML
oHtmIndex:WriteText("<title>Harbour - Reference Guide</title>")
// Add CSS to the HTML
oHtmIndex:WriteText("<style>")
oHtmIndex:WriteText("body {font-family:arial;font-size:14px;line-height:18px;}")
oHtmIndex:WriteText(".classtitle {font-weight:bold;font-size:20px;padding-bottom:4px;}")
oHtmIndex:WriteText(".functiontitle {font-weight:bold;font-size:20px;padding-bottom:4px;}")
oHtmIndex:WriteText("</style></head><body>")
oHtmIndex:WriteText("<div style='font-size:20px;font-weight:bold;margin-bottom:16px;'>Harbour Reference Guide</div>")
ASORT(aDocInfo,,, {|x, y| x[1] < y[1]})
oHtmIndex:WriteText("<div class='classtitle'>Alphabetical list of classes</div>")
oHtmIndex:WriteText("<div style='margin-left:12px;margin-bottom:12px;'>")
FOR i := 1 TO LEN(aDocInfo)
IF aDocInfo[i][3] = "C1"
oHtmIndex:WriteText("<strong>&raquo;</strong> <a href='" + aDocInfo[i][2] + "' target=_self>" + aDocInfo[i][1] + "</a><br>")
END IF
NEXT
oHtmIndex:WriteText("</div>")
oHtmIndex:WriteText("<div class='functiontitle'>Alphabetical list of functions</div>")
oHtmIndex:WriteText("<div style='margin-left:12px;margin-bottom:12px;'>")
FOR i := 1 TO LEN(aDocInfo)
IF aDocInfo[i][3] = "F1"
oHtmIndex:WriteText("<strong>&raquo;</strong> <a href='" + aDocInfo[i][2] + "' target=_self>" + aDocInfo[i][1] + "</a><br>")
END IF
NEXT
oHtmIndex:WriteText("</div>")
oHtmIndex:WriteText("<div class='functiontitle'>Alphabetical list of WinAPI functions</div>")
oHtmIndex:WriteText("<div style='margin-left:12px;margin-bottom:12px;'>")
FOR i := 1 TO LEN(aDocInfo)
IF aDocInfo[i][3] = "F2"
oHtmIndex:WriteText("<strong>&raquo;</strong> <a href='" + aDocInfo[i][2] + "' target=_self>" + aDocInfo[i][1] + "</a><br>")
END IF
NEXT
oHtmIndex:WriteText("</div>")
oHtmIndex:WriteText("</html>")
nHpj := FCREATE('chm\' + LOWER(SUBSTR(cLinkName,1,AT(".",cLinkName)-1)) +".hhp" )
FWRITE( nHpj, '[OPTIONS]' + CRLF )
FWRITE( nHpj, 'Compatibility=1.1 or later'+CRLF)
FWRITE( nHpj, 'Auto Index=Yes'+CRLF)
FWRITE( nHpj, 'Full-text search=Yes'+CRLF)
FWRITE( nHpj, 'Language=0x416 Português (brasileiro)' + CRLF )
FWRITE( nHpj, 'Contents file=.\'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hhc"+ CRLF )
FWRITE( nHpj, 'Compiled file=.\'+ lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".chm"+ CRLF )
FWRITE( nHpj, 'Display compile progress=No'+CRLF)
//nPos := aScan(aDocInfo, {|x| Upper(x[2] + ".HTM") = "OVERVIEW"})
//if nPos > 0
FWRITE( nHpj,'Default topic=index.htm' + CRLF)
//Else
//FWRITE( nHpj,'Default topic=' + lower(aDocInfo[1,2]) + CRLF)
//Endif
FWRITE( nHpj, '[FILES]' + CRLF )
For nPos:=1 to len(aDocInfo)
FWRITE( nHpj, lower(aDocInfo[npos,2]) + CRLF )
Next
FCLOSE( nHpj )
oHtm:=THTML():NewContent('chm\'+lower(substr(cLinkName,1,AT(".",cLinkName)-1)) +".hhc")
oHtm:WriteText('<!--Sitemap 1.0-->')
oHtm:Addobject("text/site properties")
oHtm:AddParam("FrameName","Ajuda")
oHtm:EndObject()
oHtm:WriteText("<ul>")
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name','Harbour Reference Guide')
oHtm:EndObject()
oHtm:WriteText("<ul>")
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', 'Alphabetical list of classes')
oHtm:AddParam('Local', 'index.htm')
oHtm:EndObject()
oHtm:WriteText("<ul>")
ASORT(aDocInfo,,, {|x, y| UPPER(x[1]) < UPPER(y[1])})
nCount_1 := 1
DO WHILE nCount_1 <= LEN(aDocInfo)
IF aDocInfo[nCount_1][3] = "C1"
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', aDocInfo[nCount_1][1])
oHtm:AddParam('Local', aDocInfo[nCount_1][2])
oHtm:EndObject()
oHtm:WriteText("<ul>")
IF LEN(aDocInfo[nCount_1][4]) > 0
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', "Methods")
oHtm:AddParam('Local', LEFT(aDocInfo[nCount_1][2], LEN(aDocInfo[nCount_1][2]) - 4) + "_content.htm#methodlist")
oHtm:EndObject()
oHtm:WriteText("<ul>")
ASORT(aDocInfo[nCount_1][4],,, {|x, y| UPPER(x[1]) < UPPER(y[1]) .AND. UPPER(x[2]) < UPPER(y[2]) })
nCount_2 := 1
DO WHILE nCount_2 <= LEN(aDocInfo[nCount_1][4])
IF aDocInfo[nCount_1][4][nCount_2, 1] = "Method"
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', aDocInfo[nCount_1][4][nCount_2, 2])
oHtm:AddParam('Local', LEFT(aDocInfo[nCount_1][2], LEN(aDocInfo[nCount_1][2]) - 4) + "_content.htm#" + aDocInfo[nCount_1][4][nCount_2, 2])
oHtm:EndObject()
ENDIF
nCount_2 ++
ENDDO
oHtm:WriteText("</ul>")
ENDIF
IF LEN(aDocInfo[nCount_1][4]) > 0
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', "Properties")
oHtm:AddParam('Local', LEFT(aDocInfo[nCount_1][2], LEN(aDocInfo[nCount_1][2]) - 4) + "_content.htm#methodlist")
oHtm:EndObject()
oHtm:WriteText("<ul>")
ASORT(aDocInfo[nCount_1][4],,, {|x, y| UPPER(x[1]) < UPPER(y[1]) .AND. UPPER(x[2]) < UPPER(y[2]) })
nCount_2 := 1
DO WHILE nCount_2 <= LEN(aDocInfo[nCount_1][4])
IF aDocInfo[nCount_1][4][nCount_2, 1] = "Data"
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', aDocInfo[nCount_1][4][nCount_2, 2])
oHtm:AddParam('Local', LEFT(aDocInfo[nCount_1][2], LEN(aDocInfo[nCount_1][2]) - 4) + "_content.htm#" + aDocInfo[nCount_1][4][nCount_2, 2])
oHtm:EndObject()
ENDIF
nCount_2 ++
ENDDO
oHtm:WriteText("</ul>")
ENDIF
oHtm:WriteText("</ul>")
ENDIF
nCount_1 ++
ENDDO
oHtm:WriteText("</ul>")
// WinAPI functions
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', 'Alphabetical list of WinAPI functions')
oHtm:AddParam('Local', 'index.htm')
oHtm:EndObject()
oHtm:WriteText("<ul>")
ASORT(aDocInfo,,, {|x, y| UPPER(x[1]) < UPPER(y[1])})
nCount_1 := 1
DO WHILE nCount_1 <= LEN(aDocInfo)
IF aDocInfo[nCount_1][3] = "F2"
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', aDocInfo[nCount_1][1])
oHtm:AddParam('Local', aDocInfo[nCount_1][2])
oHtm:EndObject()
//oHtm:WriteText("<ul>")
/*
IF LEN(aDocInfo[nCount_1][4]) > 0
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', "Methods")
oHtm:AddParam('Local', LEFT(aDocInfo[nCount_1][2], LEN(aDocInfo[nCount_1][2]) - 4) + "_content.htm#methodlist")
oHtm:EndObject()
oHtm:WriteText("<ul>")
ASORT(aDocInfo[nCount_1][4],,, {|x, y| UPPER(x[1]) < UPPER(y[1]) .AND. UPPER(x[2]) < UPPER(y[2]) })
nCount_2 := 1
DO WHILE nCount_2 <= LEN(aDocInfo[nCount_1][4])
IF aDocInfo[nCount_1][4][nCount_2, 1] = "Method"
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', aDocInfo[nCount_1][4][nCount_2, 2])
oHtm:AddParam('Local', LEFT(aDocInfo[nCount_1][2], LEN(aDocInfo[nCount_1][2]) - 4) + "_content.htm#" + aDocInfo[nCount_1][4][nCount_2, 2])
oHtm:EndObject()
ENDIF
nCount_2 ++
ENDDO
oHtm:WriteText("</ul>")
ENDIF
IF LEN(aDocInfo[nCount_1][4]) > 0
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', "Properties")
oHtm:AddParam('Local', LEFT(aDocInfo[nCount_1][2], LEN(aDocInfo[nCount_1][2]) - 4) + "_content.htm#methodlist")
oHtm:EndObject()
oHtm:WriteText("<ul>")
ASORT(aDocInfo[nCount_1][4],,, {|x, y| UPPER(x[1]) < UPPER(y[1]) .AND. UPPER(x[2]) < UPPER(y[2]) })
nCount_2 := 1
DO WHILE nCount_2 <= LEN(aDocInfo[nCount_1][4])
IF aDocInfo[nCount_1][4][nCount_2, 1] = "Data"
oHtm:ListItem()
oHtm:AddObject("text/sitemap")
oHtm:AddParam('Name', aDocInfo[nCount_1][4][nCount_2, 2])
oHtm:AddParam('Local', LEFT(aDocInfo[nCount_1][2], LEN(aDocInfo[nCount_1][2]) - 4) + "_content.htm#" + aDocInfo[nCount_1][4][nCount_2, 2])
oHtm:EndObject()
ENDIF
nCount_2 ++
ENDDO
oHtm:WriteText("</ul>")
ENDIF
*/
//oHtm:WriteText("</ul>")
ENDIF
nCount_1 ++
ENDDO
oHtm:WriteText("</ul>")
oHtm:WriteText("</ul>")
oHtm:WriteText("</ul>")
oHtm:Close()
ELSEIF lNgi
SET ALTERNATE TO "assembl.bat" ADDITIVE
@@ -789,11 +1178,11 @@ set console off
SET ALTERNATE TO "assembl.bat" ADDITIVE
SET ALTERNATE ON
SET CONSOLE OFF
? 'Copy ngi/overview.ngi .'
? 'Copy ngi/License.ngi .'
? 'Copy ngi/Funcam.txt .'
? 'Copy ngi/funcn_.txt .'
? 'copy ngi/comm.txt .'
? 'Copy ngi\overview.ngi .'
? 'Copy ngi\License.ngi .'
? 'Copy ngi\Funcam.txt .'
? 'Copy ngi\funcn_.txt .'
? 'copy ngi\comm.txt .'
? 'Compiling Sources'
? 'ngxc overview.ngi'
? 'ngxc license.ngi'
@@ -802,12 +1191,12 @@ set console off
? 'ngxc comm.txt'
? 'Linking the Guide'
? 'ngxl '+cLinkName
? 'del ngi/*.*'
? 'del ngi\*.*'
? 'del *.ngo'
ENDIF
@ INFILELINE, 0 CLEAR TO INFILELINE, MAXCOL()
@ INFILELINE, 30 SAY "Writing summary file"
@ INFILELINE, 30 SAY "Writing summary file"
ENDIF
@@ -815,13 +1204,13 @@ set console off
SET ALTERNATE ON
SET CONSOLE OFF
FOR i := 1 TO LEN( aDocInfo )
? PAD( aDocInfo[ i, 1 ], 15 ), PAD( aDocInfo[ i, 2 ], 15 ), PAD( aDocInfo[ i, 4 ], 15 )
? PAD( aDocInfo[ i, 1 ], 15 ), PAD( aDocInfo[ i, 2 ], 15 ), PAD( aDocInfo[ i, 3 ], 15 ) // 4
NEXT
// Send out list of authors
/* @ INFILELINE, 0 CLEAR TO INFILELINE, MAXCOL()
@ INFILELINE, 30 SAY "Sorting Author file"
@ INFILELINE, 0 CLEAR TO INFILELINE, MAXCOL()
@ INFILELINE, 30 SAY "Sorting Author file"
FOR i := 1 TO LEN( aAuthorList )
@@ -859,7 +1248,7 @@ set console off
UPPER( a[ 3 ] ) < UPPER( b[ 3 ] ) ) } )
@ INFILELINE, 0 CLEAR TO INFILELINE, MAXCOL()
@ INFILELINE, 30 SAY "Writing Author file"
@ INFILELINE, 30 SAY "Writing Author file"
IF LEN( aAuthorList ) > 1
i := 2
@@ -898,12 +1287,15 @@ set console off
SET ALTERNATE OFF
SET ALTERNATE TO
*/
@ MAXROW(), 0 SAY "Execute ASSEMBL.BAT to compile and link Guides"
@ MAXROW(), 0 SAY "Execute ASSEMBL.BAT to compile and link Guides"
WAIT
// Return to caller
SET CURSOR ON
RETURN NIL
// End of MAIN()
@@ -1415,7 +1807,7 @@ for nCount:=1 to Len(aWww)
aadd(aTemp,{aTop[nCount,1],aTop[nCount,2],aTop[nCount,3]})
endif
Next
asort(aTemp,,,{|x,y| x[1]<y[1]})
asort(aTemp,,,{|x,y| x[2]<y[2]})
fWrite( nFile, '2 '+cCat+CRLF)
for nCount:=1 to Len(aTemp)
fWrite( nFile, '3 '+aTemp[nCount,1]+"="+aTemp[nCount,2]+">Funca"+CRLF)
@@ -1425,10 +1817,13 @@ return nil
function GetNextContent(nPos)
Local cReturn
//tracelog( nPos)
if nPos <=Len(aResult)
cReturn := aResult[nPos]
endif
//tracelog(cReturn)
return cReturn
Function WriteChmContentFile(aTop,cCat,oHtm)
Local nCount:=0
@@ -1439,7 +1834,7 @@ for nCount:=1 to Len(aWww)
aadd(aTemp,{aTop[nCount,1],aTop[nCount,2],aTop[nCount,4]})
endif
Next
asort(aTemp,,,{|x,y| x[1]<y[1]})
asort(aTemp,,,{|x,y| x[2]<y[2]})
for nCount:=1 to Len(aTemp)
oHtm:ListItem()
@@ -1458,5 +1853,4 @@ for nCount:=1 to Len(aTemp)
Endif
next
return nil

View File

@@ -296,4 +296,4 @@ METHOD WriteChmLink( cLink, cName ) CLASS THTML
cTemp := STRTRAN( cTemp, " ", "" )
FWRITE( Self:nHandle, "<a href=" + LOWER( cTemp ) + ">" + cLink + "</a><br>" + CRLF )
Return Self
*+ EOF: HTML.PRG
*+ EOF: HTML.PRG

View File

@@ -107,6 +107,7 @@ RETURN Self
METHOD WriteTitle( cTopic, cTitle ) CLASS TNortonGuide
cTopic := HB_OEMTOANSI( cTopic )
FWRITE( Self:nHandle, "!Short: " + cTopic + CRLF )
@@ -127,4 +128,4 @@ METHOD WriteLink( cLink ) CLASS TNortonGuide
RETURN Self
*+ EOF: NG.PRG
*+ EOF: NG.PRG

View File

@@ -423,6 +423,4 @@ IF nLen<=230
aadd(aLine,ALLTRIM(cBuffer))
ENDIF
RETURN aLine
*+ EOF: OS2.PRG
*+ EOF: OS2.PRG

View File

@@ -6,7 +6,7 @@
* Harbour Project source code:
* RTF Documentation Support Code For HBDOC
*
* Copyright 2000 Luiz Rafael Culik <Culik@sl.conex.net>
* Copyright 2000-2003 Luiz Rafael Culik <culikr@uol.com.br>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
@@ -65,6 +65,8 @@ CLASS TRTF
DATA cFile
DATA nHandle
DATA aIdh init {}
DATA lastId init 100
METHOD WriteHeader()
METHOD New( cFile )
METHOD WritePar( cPar, cIden )
@@ -218,15 +220,25 @@ METHOD WriteTitle( cTitle, cTopic, cOne ,cCat) CLASS TRTF
cTemp := HB_OEMTOANSI( ALLTRIM( cTitle ) )
cTemp := STRTRAN( cTemp, "@", "x" )
ENDIF
nPos := AT( "#", cTitle )
IF nPos > 0
cTemp := ALLTRIM( HB_OEMTOANSI( STRTRAN( cTemp, "#", "\#" ) ) )
ENDIF
cTopic := ALLTRIM( HB_OEMTOANSI( cTopic ) )
cTemp := StrTran( cTemp, " ","_")
cWrite := '{\f6' + CRLF + ;
' #{\footnote \pard\fs20 # ' + "IDH_" + cTemp + ' }' + CRLF + ;
' ${\footnote \pard\fs20 $ ' + ALLTRIM( cTopic ) + ' }' + CRLF + ;
' K{\footnote \pard\fs20 K ' + UPPERLOWER(ALLTRIM( cTopic ))+";" + UPPERLOWER(ALLTRIM( cCat ))+ ' }' + CRLF + ;
' A{\footnote \pard\fs20 A ' + UPPERLOWER(ALLTRIM( cTopic )) +' }' + CRLF + ;
'}' + CRLF
Aadd( ::aIdh, {"IDH_" + cTemp,::lastid++})
cWrite := CRLF + ;
' {#{\footnote \pard\fs20 {' + "IDH_" + cTemp + ' }}}' + CRLF + ;
' {${\footnote \pard\fs20 {' + ALLTRIM( cTopic ) + ' }}}' + CRLF + ;
' {K{\footnote \pard\fs20 {' + UPPERLOWER(ALLTRIM( cTopic ))+";" + UPPERLOWER(ALLTRIM( cCat ))+ ' }}}' + CRLF + ;
' {A{\footnote{A} ' + UPPERLOWER(ALLTRIM( cTopic )) +' }}' + CRLF + ;
CRLF
/*'{\f6' + CRLF + ;*/
/*" ; " + UPPERLOWER(cCat) +" , " +UPPERLOWER(ALLTRIM( strtran(cTopic,"()","" )))+ */
aadd(aWww,{cTopic,"IDH_"+cTemp,cCat})
nPos := ascan(aResult,{|a| UPPER(a) == UPPER(cCat)})
@@ -257,10 +269,10 @@ METHOD WriteJumpTitle( cTitle, cTopic ) CLASS TRTF
cTopic := ALLTRIM( HB_OEMTOANSI( cTopic ) )
cWrite := '{\f6' + CRLF + ;
' #{\footnote \pard\fs20 # ' + "IDH_" + cTemp + ' }' + CRLF + ;
' ${\footnote \pard\fs20 $ ' + ALLTRIM( cTopic ) + ' }' + CRLF + ;
'}' + CRLF
cWrite := CRLF + ;
' #{\footnote \pard\fs20 ' + "IDH_" + cTemp + ' }' + CRLF + ;
' ${\footnote \pard\fs20 ' + ALLTRIM( cTopic ) + ' }' + CRLF + ;
CRLF
FWRITE( Self:nHandle, cWrite )
@@ -306,19 +318,17 @@ Local cItem:=' '
Local nPos:=0
Local nSize:=Len(aLink)
HB_SYMBOL_UNUSED( lAlink )
if nSize >2
For nPos:=1 to nSize
if nPos==nSize
cItem+= aLink[nPos]
cItem+= UPPERLOWER(aLink[nPos])
else
cItem+= aLink[nPos]
cItem+= UPPERLOWER(aLink[nPos])
cItem+=";"
endif
next
cItem:=Alltrim(cItem)
FWRITE( Self:nHandle, '\par \pard\cf1\fs20 \{button , ALink('+cItem + ', 2) \}{\f6\uldb Related Topic }'+'{\v\f6 %!ALink(" '+cItem + '", 2) }'+ CRLF )
FWRITE( Self:nHandle, '\par \pard\cf1\fs20 \{button , ALink('+UPPER(cItem) + ', 2) \}{\f6\uldb Related Topic }'+'{\v\f6 %!ALink(" '+cItem + '", 2) }'+ CRLF )
else
For nPos:=1 to nSize
FWRITE( Self:nHandle, '\par \pard\cf1\fs20 {\f6\uldb '+aLink[nPos] +' }{\v\f6 !KLink(" '+UPPERLOWER(aLink[nPos]) + '", 2) }'+ CRLF )

View File

@@ -0,0 +1,117 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* TEEASC support module for hbdoc document Extractor
* To separate the doc from the source
*
* Copyright 2004 Lorenzo Fiorini <lorenzo_fiorini@teamwork.it>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "directry.ch"
#include "fileio.ch"
#include "inkey.ch"
#define CRLF HB_OSNewLine()
#define DELIM "$" // keyword delimiter
MEMVAR aDirList
FUNCTION TeeFiles()
LOCAL i
LOCAL nFiles := LEN( aDirList )
LOCAL cFileName
LOCAL lDoc
LOCAL cBuffer
LOCAL nReadHandle
LOCAL nSourceHandle
LOCAL nDocHandle
LOCAL cDoc := DELIM + "DOC" + DELIM // DOC keyword
LOCAL cEnd := DELIM + "END" + DELIM // END keyword
FOR i := 1 TO nFiles
cFileName := aDirList[ i, F_NAME ]
nReadHandle := fopen( cFileName )
nSourceHandle := fcreate( "teesrcs\" + cFileName )
nDocHandle := fcreate( "teedocs\" + cFileName )
lDoc := .F.
DO WHILE freadline( nReadHandle, @cBuffer, 256 )
IF AT( cDoc, cBuffer ) > 0
lDoc := .T.
ELSEIF AT( cEnd, cBuffer ) > 0
lDoc := .F.
cBuffer += CRLF
FWRITE( nDocHandle, cBuffer, len( cBuffer ) )
freadline( nReadHandle, @cBuffer, 256 )
cBuffer += CRLF
FWRITE( nDocHandle, cBuffer, len( cBuffer ) )
LOOP
ENDIF
cBuffer += CRLF
IF lDoc
FWRITE( nDocHandle, cBuffer, len( cBuffer ) )
ELSE
FWRITE( nSourceHandle, cBuffer, len( cBuffer ) )
ENDIF
ENDDO
fclose( nReadHandle )
fclose( nSourceHandle )
fclose( nDocHandle )
NEXT
RETURN NIL

View File

@@ -10,18 +10,20 @@ ROOT = ../../
PRG_SOURCES=\
hbmake.prg \
tmake.prg \
hbmutils.prg \
fclass1.prg \
ffile1.prg \
ft_funcs.prg \
radios.prg \
checks.prg \
checks.prg \
pickarry.prg \
pickfile.prg \
prb_stak.prg \
C_SOURCES=\
hbmlang.c \
hbmlang.c \
readline.c \
PRG_MAIN=hbmake.prg

View File

@@ -109,11 +109,9 @@ FUNCTION FT_FUSE( cFile AS STRING, nMode AS NUMERIC)
theHandle:closefile()
ENDIF
IF cFile <> Nil
IF nMode <> 0
theHandle := HBMake_FileBase():new( cFile ):open()
ELSE
theHandle := HBMake_FileBase():new( cFile ):open()
ENDIF
theHandle := HBMake_FileBase():new( cFile )
theHandle:nOpenMode := nMode
theHandle:open()
ENDIF
nHandle:= theHandle:nHan
RETURN nHandle

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,143 +1,264 @@
/*
* $Id$
*/
* xHarbour Project source code:
* hbmake.prg xHarbour make utility main file
*
* Copyright 2000,2001,2002,2003,2004 Luiz Rafael Culik <culikr@uol.com.br>
* www - http://www.xharbour.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
*+²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
*+
*+ Source Module => D:\SRC\PBMAKE\PICKARRY.PRG
*+
*+ PBMake is a Clipper, C, ASM, Xbase++ make engine.
*+
*+ Copyright(C) 1996-1999 by Phil Barnett.
*+
*+ This program is free software; you can redistribute it and/or modify it
*+ under the terms of the GNU General Public License as published by the
*+ Free Software Foundation; either version 2 of the License, or (at your
*+ option) any later version.
*+
*+ This program is distributed in the hope that it will be useful, but
*+ WITHOUT ANY WARRANTY; without even the implied warranty of
*+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*+ General Public License for more details.
*+
*+ You should have received a copy of the GNU General Public License along
*+ with this program; if not, write to the Free Software Foundation, Inc.,
*+ 675 Mass Ave, Cambridge, MA 02139, USA.
*+
*+ You can contact me at:
*+
*+ Phil Barnett
*+ Box 944
*+ Plymouth, Florida 32768
*+
*+ or
*+
*+ philb@iag.net
*+
*+
*+ Functions: Function PICKARRY()
*+ Function Keys()
*+
*+ Reformatted by Click! 2.03 on Mar-30-1999 at 11:19 pm
*+
*+²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
static someitems
STATIC someitems
STATIC lAdd := .F.
STATIC cMarkChar := '*' // 'û' // character showed when <F5> is pressed to select prgs/libs.
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
*+ Function PICKARRY()
*+
*+ Called from ( makelink.prg ) 1 - function makelink()
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
function PICKARRY( T, L, b, r, IN_ARRAY, OUT_ARRAY )
#include "common.ch"
#include "achoice.ch"
local nChoice := 1
local x
local NEW_ARRAY := {}
local NUM_ELEMS := len( IN_ARRAY )
local PAD_LEN := ( r - 1 ) - ( L + 1 )
local lIsChecked
someitems := 0
FUNCTION PICKARRY( T, L, b, r, IN_ARRAY, OUT_ARRAY, aDefault, lAllowAll, cTitle, lLib )
putscreen()
LOCAL nChoice := 1
LOCAL x
LOCAL NEW_ARRAY := {}
LOCAL NUM_ELEMS := Len( IN_ARRAY )
LOCAL PAD_LEN := ( r - 1 ) - ( L + 1 )
LOCAL lIsChecked := .f.
LOCAL aItems := IN_ARRAY
LOCAL aTemp
LOCAL cItem
LOCAL cItem1
LOCAL cTemp
LOCAL cOldColor := Setcolor()
@ T - 1, L - 1 clear to b + 1, r + 1
@ T - 1, L - 1 to b + 1, r + 1 double
DEFAULT lAllowAll TO .F.
DEFAULT cTitle to ""
DEFAULT lLib to .F.
for x := 1 to NUM_ELEMS
IN_ARRAY[ X ] := padr( ' ' + IN_ARRAY[ X ], PAD_LEN )
OUT_ARRAY[ X ] := ' ' + OUT_ARRAY[ X ]
next
do while nChoice != 0
nChoice := achoice( T, L , b , r , IN_ARRAY, , 'keys' , nChoice, 1 )
SOMEITEMS := 0
if nChoice > 0
PutScreen()
lIsChecked := substr( IN_ARRAY[ nChoice ], 2, 1 ) == 'û'
Setcolor( 'gr+/rb,b+/w,w+/b,w/b+,w/b,w+/b' )
IN_ARRAY[ nChoice ] := stuff( IN_ARRAY[ nChoice ], 2, 1, if( lIsChecked, ' ', 'û' ) )
OUT_ARRAY[ nChoice ] := stuff( OUT_ARRAY[ nChoice ], 1, 1, if( lIsChecked, ' ', 'û' ) )
@ T - 2, L - 1 CLEAR TO b + 1, r + 1
@ T - 2, L say cTitle
@ T - 1, L - 1 TO b + 1, r + 1 double
if lIsChecked
SOMEITEMS --
else
SOMEITEMS ++
endif
FOR x := 1 TO NUM_ELEMS
IN_ARRAY[ X ] := Padr( ' ' + IN_ARRAY[ X ], PAD_LEN )
OUT_ARRAY[ X ] := ' ' + OUT_ARRAY[ X ]
NEXT
nChoice ++
//aTemp :=GetFiles(aitems)
endif
IF Len( aDefault ) > 0
enddo
for x := 1 to NUM_ELEMS
if left( OUT_ARRAY[ X ], 1 ) == 'û'
aadd( NEW_ARRAY, substr( OUT_ARRAY[ X ], 2 ) )
endif
IN_ARRAY[ X ] := substr( IN_ARRAY[ X ], 4 )
next
FOR EACH cItem IN aDefault
asize( OUT_ARRAY, len( NEW_ARRAY ) )
acopy( NEW_ARRAY, OUT_ARRAY )
if !lLib
x := AScan( IN_ARRAY, { | a, y | SubStr( a, 4, At(' ', alltrim(a) ) - 1 ) == cItem } )
else
x := AScan( IN_ARRAY, { | a, y | alltrim(cItem) IN a } )
endif
getscreen()
IF x != 0
return len( NEW_ARRAY )
IN_ARRAY[ x ] := Stuff( IN_ARRAY[ x ], 2, 1, If( lIsChecked, ' ', cMarkChar ) )
OUT_ARRAY[ x ] := Stuff( OUT_ARRAY[ x ], 1, 1, If( lIsChecked, ' ', cMarkChar ) )
SOMEITEMS ++
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
*+ Function Keys()
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
function Keys( MODE )
ELSE
local RETVAL := 2
local THEKEY := lastkey()
cItem := SubStr( cItem, Rat( '\', cItem ) - 1 )
if MODE = 1
keyboard chr( 30 )
elseif MODE = 2
keyboard chr( 31 )
elseif MODE = 3
if THEKEY = 32
RETVAL := 1
elseif THEKEY = 27
RETVAL := 0
elseif THEKEY = 13 .and. SOMEITEMS < 1
RETVAL := 1
keyboard chr( 13 )
elseif THEKEY = 13
keyboard chr( 24 )
RETVAL := 0
endif
endif
if !lLib
x := AScan( aTemp, { | a, y | SubStr( a, 4, At( ' ', a ) - 1 ) == cItem } )
else
x := AScan( IN_ARRAY, { | a, y | alltrim(cItem) IN a } )
endif
return ( RETVAL )
IF x != 0
IN_ARRAY[ x ] := Stuff( IN_ARRAY[ x ], 2, 1, If( lIsChecked, ' ', cMarkChar ) )
OUT_ARRAY[ x ] := Stuff( OUT_ARRAY[ x ], 1, 1, If( lIsChecked, ' ', cMarkChar ) )
SOMEITEMS ++
ENDIF
*+ EOF: PICKARRY.PRG
ENDIF
NEXT
ENDIF
Clear TypeAhead
WHILE nChoice != 0
@T,L CLEAR TO b, r
nChoice := AChoice( T, L, b, r, IN_ARRAY,, 'keys', nChoice, 1 )
IF nChoice > 0
if lAllowAll
if lAdd // only if F5 was pressed
For nChoice := 1 to NUM_ELEMS
lIsChecked := Substr( IN_ARRAY[ nChoice ], 2, 1 ) == cMarkChar
IN_ARRAY[ nChoice ] := Stuff( IN_ARRAY[ nChoice ], 2, 1, If( lIsChecked, ' ', cMarkChar ) )
OUT_ARRAY[ nChoice ] := Stuff( OUT_ARRAY[ nChoice ], 1, 1, If( lIsChecked, ' ', cMarkChar ) )
IF lIsChecked
SOMEITEMS --
ELSE
SOMEITEMS ++
ENDIF
lAdd := .F.
Next
else
lIsChecked := Substr( IN_ARRAY[ nChoice ], 2, 1 ) == cMarkChar
IN_ARRAY[ nChoice ] := Stuff( IN_ARRAY[ nChoice ], 2, 1, If( lIsChecked, ' ', cMarkChar ) )
OUT_ARRAY[ nChoice ] := Stuff( OUT_ARRAY[ nChoice ], 1, 1, If( lIsChecked, ' ', cMarkChar ) )
IF lIsChecked
SOMEITEMS --
ELSE
SOMEITEMS ++
ENDIF
nChoice ++
endif
else
lIsChecked := Substr( IN_ARRAY[ nChoice ], 2, 1 ) == cMarkChar
IN_ARRAY[ nChoice ] := Stuff( IN_ARRAY[ nChoice ], 2, 1, If( lIsChecked, ' ', cMarkChar ) )
OUT_ARRAY[ nChoice ] := Stuff( OUT_ARRAY[ nChoice ], 1, 1, If( lIsChecked, ' ', cMarkChar ) )
IF lIsChecked
SOMEITEMS --
ELSE
SOMEITEMS ++
ENDIF
endif
ENDIF
ENDDO
FOR x := 1 TO NUM_ELEMS
IF Left( OUT_ARRAY[ X ], 1 ) == cMarkChar
AAdd( NEW_ARRAY, Substr( OUT_ARRAY[ X ], 2 ) )
ENDIF
IN_ARRAY[ X ] := Substr( IN_ARRAY[ X ], 4 )
NEXT
ASize( OUT_ARRAY, Len( NEW_ARRAY ) )
ACopy( NEW_ARRAY, OUT_ARRAY )
GetScreen()
SetColor( coldColor )
RETURN Len( NEW_ARRAY )
*--------------------
FUNCTION Keys( MODE )
*--------------------
LOCAL RETVAL := AC_CONT
LOCAL THEKEY := Lastkey()
IF MODE = AC_HITTOP
KEYBOARD Chr( 30 )
ELSEIF MODE = AC_HITBOTTOM
KEYBOARD Chr( 31 )
ELSEIF MODE = AC_EXCEPT
IF THEKEY = 32 // space bar to select/unselect
RETVAL := AC_SELECT
ELSEIF THEKEY == -4 // F5 (select all itens)
lAdd := !lAdd
RETVAL := AC_SELECT
ELSEIF THEKEY = 27
RETVAL := AC_ABORT
ELSEIF THEKEY = 13 .AND. SOMEITEMS < 1
RETVAL := AC_ABORT
KEYBOARD CHR( 13 )
ELSEIF THEKEY = 13
KEYBOARD CHR( 24 )
RETVAL := AC_ABORT
ENDIF
ENDIF
RETURN ( RETVAL )
*------------------------------
STATIC FUNCTION GetFiles( aIn )
*-------------------------------
LOCAL aRet := {}
LOCAL cItem := ""
FOR EACH cItem IN aIn
cItem := Substr( cItem, 1, At( ' ', cItem ) - 1 )
AAdd( aRet, Substr( cItem, 1, At( ' ', cItem ) ) )
NEXT
RETURN aRet

View File

@@ -1,8 +1,6 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* radios.Prg radios gets for hbmake
@@ -64,8 +62,7 @@ LOCAL nRow := Row(), nCol := Col()
LOCAL nGets := Len(aChoices)
LOCAL nGet
LOCAL nStartGet := Len(aGetList) + 1
default bvalid to {||.t.}
default bvalid to {||.t.}
// For each element in aChoices
FOR nGet := 1 To nGets
@@ -78,8 +75,8 @@ LOCAL nStartGet := Len(aGetList) + 1
oGet := GetNew(nRow++,ncol+4,t(aChoices[nGet]),cvar)
Aadd(aGetList, oGet)
oGet:cargo := Array(RADIO_NUM_IVARS)
oGet:PostBlock := bValid
oGet:cargo := Array(RADIO_NUM_IVARS)
oGet:PostBlock:=bValid
oGet:radioGsb := bVar
oGet:radioGets := Array(nGets)

View File

@@ -0,0 +1,251 @@
/*
* $Id$
*/
/*
* xHarbour Project source code:
* Text file reading functions
*
* Copyright 2003 Marcelo Lombardo - lombardo@uol.com.br
* http://www.xharbour.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include <ctype.h>
#include "hbapi.h"
#include "hbapifs.h"
#include "hb_io.h"
#include "hbset.h"
#include "hbapiitm.h"
#include "hbapierr.h"
#define READING_BLOCK 4096
BYTE * hb_fsReadLine( FHANDLE hFileHandle, LONG *plBuffLen, char ** Term, int * iTermSizes, USHORT iTerms, BOOL * bFound, BOOL *bEOF )
{
USHORT uiPosTerm = 0, iPos, uiPosition;
USHORT nTries;
LONG lRead = 0, lOffset, lSize;
BYTE * pBuff;
HB_TRACE(HB_TR_DEBUG, ("hb_fsReadLine(%p, %ld, %p, %p, %hu, %i, %i)", hFileHandle, *plBuffLen, Term, iTermSizes, iTerms, *bFound, *bEOF ));
*bFound = 0;
*bEOF = 0;
nTries = 0;
lOffset = 0;
lSize = *plBuffLen;
if( *plBuffLen < 10 )
{
*plBuffLen = READING_BLOCK;
}
pBuff = (BYTE*) hb_xgrab( *plBuffLen );
do
{
if(nTries>0)
{
/* pBuff can be enlarged to hold the line as needed.. */
lSize = ( *plBuffLen * ( nTries + 1 ) ) + 1;
pBuff = (BYTE *) hb_xrealloc( pBuff, lSize );
lOffset += lRead;
}
/* read from file */
lRead = hb_fsReadLarge( hFileHandle, pBuff + lOffset, lSize-lOffset );
/* scan the read buffer */
if (lRead>0)
{
for( iPos=0; iPos<lRead; iPos++ )
{
for( uiPosTerm=0;uiPosTerm < iTerms;uiPosTerm++)
{
/* Compare with the LAST terminator byte */
if( pBuff[lOffset+iPos] == Term[uiPosTerm][iTermSizes[uiPosTerm]-1] && (iTermSizes[uiPosTerm]-1) <= (iPos+lOffset) )
{
*bFound = 1;
for(uiPosition=0; uiPosition < (iTermSizes[uiPosTerm]-1); uiPosition++)
{
if(Term[uiPosTerm][uiPosition] != pBuff[ lOffset+(iPos-iTermSizes[uiPosTerm])+uiPosition+1 ])
{
*bFound = 0;
break;
}
}
if( *bFound )
{
break;
}
}
}
if(*bFound)
{
break;
}
}
if( *bFound )
{
*plBuffLen = lOffset + iPos - iTermSizes[ uiPosTerm ] + 1;
pBuff[ *plBuffLen ] = '\0';
/* Set handle pointer in the end of the line */
hb_fsSeek( hFileHandle, (((lRead-((LONG)iPos)))*-1)+1, FS_RELATIVE );
return( pBuff );
}
}
else
{
if( !*bFound )
{
if( nTries == 0 )
{
pBuff[0] = '\0';
*plBuffLen = 0;
}
else
{
pBuff[ lOffset + lRead ] = '\0';
*plBuffLen = lOffset + lRead;
}
*bEOF = 1;
}
}
nTries++;
}
while ((!*bFound) && lRead > 0 );
return( pBuff );
}
/* PRG level fReadLine( <Handle>, <@buffer>, [<aTerminators | cTerminator>], [<nReadingBlock>] ) */
HB_FUNC( HB_FREADLINE )
{
PHB_ITEM pTerm1;
PHB_ITEM Opt = hb_itemNew( NULL );
FHANDLE hFileHandle = (FHANDLE) hb_parnl( 1 );
char ** Term;
BYTE * pBuffer;
int * iTermSizes;
LONG lSize = hb_parnl(4);
USHORT i, iTerms;
BOOL bFound, bEOF;
if( ( !ISBYREF( 2 ) ) || ( !ISNUM( 1 ) ) )
{
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "FREADLINE", 4, hb_paramError(1), hb_paramError(2), hb_paramError(3), hb_paramError(4) );
return;
}
if( ISARRAY( 3 ) || ISCHAR( 3 ) )
{
if( ISARRAY( 3 ) )
{
pTerm1 = hb_param( 3, HB_IT_ARRAY );
iTerms = (int) hb_arrayLen(pTerm1);
if( iTerms <= 0 )
{
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "FREADLINE", 4,
hb_paramError(1), hb_paramError(2),
hb_paramError(3), hb_paramError(4) );
return;
}
Term = (char**) hb_xgrab( sizeof(char*) * iTerms );
iTermSizes = (int *) hb_xgrab( sizeof(int) * iTerms );
hb_itemClear( Opt );
for(i=0;i<iTerms;i++)
{
hb_arrayGet( pTerm1, i + 1, Opt );
Term[i] = (char *) hb_itemGetCPtr(Opt);
iTermSizes[i] = hb_itemGetCLen(Opt);
}
}
else
{
pTerm1 = hb_param( 3, HB_IT_STRING );
Term = (char**) hb_xgrab( sizeof(char*) );
iTermSizes = (int *) hb_xgrab( sizeof(int) );
Term[0] = (char *) hb_itemGetCPtr(pTerm1);
iTermSizes[0] = hb_itemGetCLen(pTerm1);
iTerms = 1;
}
}
else
{
Term = (char**) hb_xgrab( sizeof(char*) );
iTermSizes = (int *) hb_xgrab( sizeof(int) );
Term[0] = (char *) "\r\n"; /* Should be preplaced with the default EOL sequence */
iTerms = 1;
iTermSizes[0] = 2;
}
if( lSize == 0 )
{
lSize = READING_BLOCK ;
}
pBuffer = hb_fsReadLine( hFileHandle, &lSize, Term, iTermSizes, iTerms, &bFound, &bEOF );
hb_storclen_buffer( (char*) pBuffer, lSize, 2 );
hb_retnl( bEOF ? -1 : 0 );
hb_xfree( Term );
hb_xfree( iTermSizes );
hb_itemRelease( Opt );
}

View File

@@ -0,0 +1,597 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* tmake.prg file generator for hbmake
*
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*/
#include "hbclass.ch"
#include "common.ch"
#define EOL hb_osnewline()
#define CRLF hb_osnewline()
Static lEof := .F.
*------------
CLASS THBMAKE
*------------
EXPORT:
DATA aDefines Init {}
DATA aBuildOrder Init {}
DATA aCommands Init {}
DATA aMacros Init {}
DATA aPrgs Init {}
DATA aExtLibs Init {}
DATA aCs Init {}
DATA aObjs Init {}
DATA aObjsc Init {}
DATA aRes Init {}
DATA nLinkHandle
DATA cLinkcomm Init ''
DATA lCompress Init .F.
DATA lForce Init .F.
DATA lLinux Init .F.
DATA szProject Init ""
DATA lLibrary Init .F.
DATA lInstallLib Init .F.
DATA lIgnoreErrors Init .F.
DATA lExtended Init .T.
DATA lOs2 Init .F.
DATA lRecurse Init .F.
DATA aDir
DATA lEditMode Init .F.
DATA aDir
DATA aLangMessages init {}
DATA cDefLang
DATA lFwh init .F.
DATA lxFwh init .F.
DATA lCw init .F.
DATA lMini init .F.
DATA lHwgui init .F.
DATA lGui Init .F.
DATA lGtwvt init .F.
DATA lGtwvw init .F.
DATA lMWvW init .F.
DATA lXWT init .F.
DATA lxHGtk init .F.
DATA lWhoo init .F.
DATA lWhat32 init .F.
DATA lRddAds init .F.
DATA lMediator init .F.
DATA cMakefile init ""
DATA lExternalLib init .F.
DATA cObj init ""
DATA cUserdef init ""
DATA cUserInclude init ""
DATA cUserLib init ""
DATA lGenppo init .f.
DATA lCompMod init .f.
DATA lAutomemvar init .f.
DATA lvarismemvar init .f.
DATA ldebug init .f.
DATA lSupressline init .f.
DATA StartPath init ""
DATA cFmc init ""
DATA cMedpath init ""
DATA cAppLibName init ""
DATA cOs init ""
DATA cTopfile init ""
DATA aOut init {}
DATA cFilesToAdd init 5
DATA lMT init .F.
DATA cWarningLevel init 0
DATA cTopModule init ""
DATA cRes init ""
DATA cMacro init ""
DATA lGenCsource init .f. // Ath added 31-05-2006
DATA cShell init ""
DATA cEditor init ""
METHOD New()
METHOD ReadMakefile(cFile)
METHOD ReplaceMacros( cMacros )
METHOD FindMacro( cMacro, cRead )
ENDCLASS
*-------------------------
METHOD New() CLASS THbMake
*-------------------------
::cObj := "obj" + Space( 40 )
::cUserdef := Space( 200 )
::cUserInclude := Space( 200 )
::cUserLib := Space( 200 )
::cFMC := Space( 200 )
::cAppLibName := Space( 20 )
::cTopModule := Space( 20 )
::cEditor := ""
return self
*---------------------------------------
METHOD ReadMakefile(cFile) CLASS THbMake
*---------------------------------------
LOCAL cBuffer := {}
LOCAL cMacro := ::cMacro
LOCAL cDep := "#DEPENDS"
LOCAL cOpt := "#OPTS"
LOCAL cCom := "#COMMANDS"
LOCAL cBuild := "#BUILD"
LOCAL cTemp := ""
LOCAL cTemp1 := ''
LOCAL aTemp := {}
LOCAL lMacrosec := .f.
LOCAL lBuildSec := .f.
LOCAL lComSec := .f.
LOCAL aTemp1 := {}
LOCAL cCfg := ""
LOCAL lCfgFound := .F.
LOCAL aTempCFiles := {}
Local nHandle
Local cObjitem
Local cRes := ""
Local cItem
LOCAL lLinux := At( 'linux', Lower( Os() ) ) > 0
Local lExtended := .T., szProject
LOCAL lPrgObjRule := .F.
nHandle := FT_FUSE( cFile )
IF nHandle < 0
RETURN self
ENDIF
cBuffer := Trim( Substr( ReadLN( @lEof ), 1 ) )
::lLibrary :=.f.
WHILE !leof
IF At( cMacro, cBuffer ) > 0
lMacroSec := .T.
lBuildSec := .f.
lComSec := .f.
ELSEIF At( cBuild, cBuffer ) > 0
lMacroSec := .f.
lBuildSec := .T.
lComSec := .f.
ELSEIF At( cCom, cBuffer ) > 0
lBuildSec := .f.
lComSec := .t.
lMacroSec := .f.
ELSE
? "Invalid Make File"
Fclose( nHandle )
RETURN Nil
ENDIF
cTemp := Trim( Substr( ReadLN( @lEof ), 1 ) )
IF At( "//", ctemp ) > 0
WHILE At( "//", ctemp ) > 0
ctemp := Strtran( ctemp, " //", "" )
cTemp += Trim( Substr( ReadLN( @lEof ), 1 ) )
ENDDO
ctemp := Strtran( ctemp, " //", "" )
ENDIF
aTemp := ListasArray2( Alltrim( cTemp ), "=" )
IF lmacrosec
IF Alltrim( Left( ctemp, 7 ) ) <> '!ifndef' .and. Alltrim( Left( ctemp, 6 ) ) <> "!endif" .and. Alltrim( Left( ctemp, 7 ) ) <> '!iffile' .and. Alltrim( Left( ctemp, 7 ) ) <> '!stdout' .and. Alltrim( Left( ctemp, 6 ) ) <> '!ifdef'
IF Len( aTemp ) > 1
IF At( "$", aTemp[ 2 ] ) > 0
Aadd( ::aMacros, { aTemp[ 1 ], ::replacemacros( aTemp[ 2 ] ) } )
ELSE
Aadd( ::aMacros, { aTemp[ 1 ], aTemp[ 2 ] } )
// tracelog(aTemp[ 1 ], aTemp[ 2 ])
ENDIF
ENDIF
IF aTemp[ 1 ] == "PROJECT"
::cAppLibName := aTemp[ 2 ]
::cAppLibName := strtran(::cAppLibName ,"$(PR)","")
::cAppLibName := strtran(::cAppLibName ,".exe","")
::cAppLibName := strtran(::cAppLibName ,".lib","")
ENDIF
IF aTemp[ 1 ] == "LIBFILES"
::lRddAds := "rddads" $ aTemp[ 2 ]
ENDIF
IF aTemp[ 1 ] == "C4W"
::cFMC:= aTemp[2]
::lCw :=.t.
endif
IF aTemp[ 1 ] == "FWH"
::cFMC:= aTemp[2]
::lFwh :=.t.
endif
IF aTemp[ 1 ] == "MINIGUI"
::cFMC:= aTemp[2]
::lmini :=.t.
endif
IF aTemp[ 1 ] == "HWGUI"
::cFMC:= aTemp[2]
::lHwGui :=.t.
endif
IF aTemp[ 1 ] == "GTWVT"
::cFMC:= ""
::lGtwvt :=.t.
endif
IF aTemp[ 1 ] == "GTWVW"
::cFMC:= ""
::lGtwvw :=.t.
endif
IF aTemp[ 1 ] == "MWVW"
::cFMC:= ""
::lGtwvw :=.t.
::lMWvW :=.t.
endif
IF aTemp[ 1 ] == "XWT"
::cFMC:= ""
::lXWT :=.t.
endif
IF aTemp[ 1 ] == "WHOO"
::cFMC:= aTemp[2]
::lWhoo :=.t.
endif
IF aTemp[ 1 ] == "WHAT32"
::cFMC:= aTemp[2]
::lWhat32 :=.t.
endif
IF aTemp[ 1 ] == "XHGTK"
::cFMC:= aTemp[2]
::lxHGtk :=.t.
endif
IF aTemp[ 1 ] == "MEDIATOR"
::cMedpath:= aTemp[2]
::lmEDIATOR :=.t.
endif
IF aTemp[ 1 ] == "COMPRESS"
::lCompress := "YES" $ aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "SHELL"
::cShell := aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "EXTERNALLIB"
::lExternalLib := "YES" $ aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "XFWH"
::lxFwh := "YES" $ aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "FILESTOADD"
::cFilesToAdd := Val( aTemp[ 2 ] )
endif
IF aTemp[ 1 ] == "MT"
::lMt := "YES" $ aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "GUI"
::lGUI := "YES" $ aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "WARNINGLEVEL"
::cWarningLevel := Val( aTemp[ 2 ] )
endif
IF aTemp[ 1 ] == "OBJFILES"
cObjitem := substr( atemp[ 2 ],1,at(")",atemp[ 2 ]))
::cObj := ::replacemacros(cObjItem)
::aObjs := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
ENDIF
IF aTemp[ 1 ] == "OBJCFILES"
aTemp1 := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
IF Len( atemp1 ) == 1
IF !Empty( atemp[ 1 ] )
::aObjsC := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
ENDIF
ELSE
::aObjsC := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
ENDIF
ENDIF
IF aTemp[ 1 ] == "PRGFILES"
::aPrgs := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
lExtended := .T.
ENDIF
IF aTemp[ 1 ] == "PRGFILE"
::aPrgs := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
ENDIF
IF atemp[ 1 ] == "CFILES"
IF lExtended
aTempCFiles := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
IF ( Len( aTempCFiles ) == 1 )
IF !Empty( aTempCFiles[ 1 ] )
::aCs := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
ENDIF
ELSE
::aCs := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
ENDIF
ELSE
::aCs := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
ENDIF
ENDIF
IF aTemp[ 1 ] == "EXTLIBFILES"
::aExtLibs := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
ENDIF
IF atemp[ 1 ] == "RESFILES"
::aRes := Listasarray2( ::replacemacros( atemp[ 2 ] ), " " )
FOR EACH cItem in :: aRes
::cRes += cItem +" "
NEXT
ENDIF
IF aTemp[ 1 ] == "RECURSE"
::lRecurse := AT( "YES" , aTemp[ 2 ] ) > 0
ENDIF
IF aTemp[ 1 ] == "LIBRARY"
::lLibrary := AT( "YES", aTemp[ 2 ] ) > 0
ENDIF
IF aTemp[ 1 ] == "INSTALLLIB"
::lInstallLib := AT( "YES", aTemp[ 2 ] ) > 0
ENDIF
IF aTemp[ 1 ] == "HARBOURFLAGS"
::lGenppo := AT( "-p" , aTemp[ 2 ] ) > 0
::lCompMod := AT( "-m" , aTemp[ 2 ] ) > 0
::lAutomemvar := AT( "-a" , aTemp[ 2 ] ) > 0
::lvarismemvar := AT( "-v" , aTemp[ 2 ] ) > 0
::ldebug := AT( "-b" , aTemp[ 2 ] ) > 0
::lSupressline := AT( "-l" , aTemp[ 2 ] ) > 0
aTemp[ 2 ] := strtran(aTemp[ 2 ],"-p","")
aTemp[ 2 ] := strtran(aTemp[ 2 ],"-m","")
aTemp[ 2 ] := strtran(aTemp[ 2 ],"-a","")
aTemp[ 2 ] := strtran(aTemp[ 2 ],"-v","")
aTemp[ 2 ] := strtran(aTemp[ 2 ],"-b","")
aTemp[ 2 ] := strtran(aTemp[ 2 ],"-l","")
aTemp[ 2 ] := Alltrim( aTemp[ 2 ] )
endif
IF aTemp[ 1 ] == "USERDEFINE"
::cUserDef := aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "USERINCLUDE"
::cUserInclude := aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "USERLIBS"
::cUserLib := aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "TOPMODULE"
::cTopModule := aTemp[ 2 ]
endif
IF aTemp[ 1 ] == "EDITOR"
::cEditor := aTemp[ 2 ]
endif
ENDIF
ENDIF
IF lbuildSec
szProject := cTemp
::aBuildOrder := Listasarray2( cTemp, ":" )
ENDIF
IF lComSec // Ath added 31-05-2006
IF lPrgObjRule
::lGenCsource := "-go3" $ LOWER(cTemp)
lPrgObjRule := .F.
ENDIF
IF aTemp[ 1 ] == ".prg.obj:" .OR. aTemp[ 1 ] == ".prg.o:"
lPrgObjRule := .T.
ENDIF
ENDIF // end Ath added 31-05-2006
IF cTemp = "#BUILD"
cBuffer := cTemp
ELSEIF cTemp == "#COMMANDS"
cbuffer := cTemp
ENDIF
ENDDO
qout( nhandle)
Fclose( nHandle )
RETURN self
*--------------------------------------------
METHOD ReplaceMacros( cMacros ) CLass THBMAKE
*--------------------------------------------
LOCAL nCount := 0
LOCAL aTempMacros := {}
LOCAL aLocalMacros := {}
aTempMacros := Listasarray2( cMacros, " " )
AEval( aTempMacros, { | xMacro | If( At( "$", xMacro ) > 0, ;
IF( At( ";", xMacro ) > 0, ( aLocalMacros := Listasarray2( xMacro, ";" ), ;
Aeval( aLocalMacros, { | x | ::FindMacro( x, @cMacros ) } ) ), ;
::FindMacro( xMacro, @cMacros ) ), ) } )
RETURN cMacros
*----------------------------------------------
METHOD FindMacro( cMacro, cRead ) CLASS THBMAKE
*----------------------------------------------
LOCAL nPos
LOCAL cTemp
LOCAL aLocalMacros := {}
cMacro := Substr( cMacro, 1, At( ")", cMacro ) )
IF At( "-", cMacro ) > 0
cMacro := Substr( cMacro, 3 )
ENDIF
IF At( ";", cMacro ) > 0
cMacro := Substr( cMacro, At( ";", cMacro ) + 1 )
ENDIF
nPos := Ascan( ::aMacros, { | x | "$(" + Alltrim( x[ 1 ] ) + ")" == cMacro } )
IF nPos = 0
cTemp := Strtran( cMacro, "$(", "" )
cTemp := Strtran( cTemp, ")", "" )
IF !Empty( cTemp )
cRead := Alltrim( Strtran( cRead, cMacro, Gete( cTemp ) ) )
ENDIF
ELSE
cRead := Alltrim( Strtran( cRead, cMacro, ::aMacros[ nPos, 2 ] ) )
ENDIF
RETURN cRead