2003-08-23 13:20 UTC+0200 Tomaz Zupan <tomaz.zupan@orpo.si>

This commit is contained in:
Tomaz Zupan
2003-08-23 11:16:03 +00:00
parent 7f1b30d59e
commit 4d6e1a475a
5 changed files with 105 additions and 86 deletions

View File

@@ -72,6 +72,8 @@ 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
@@ -110,6 +112,9 @@ 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 )
@@ -360,15 +365,15 @@ METHOD goBottom() CLASS FileBase
cBuffer := SPACE( pBUFFER_LENGTH )
FSEEK( Self:nDosHandle, - ( pBUFFER_LENGTH ), 2 )
FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH )
IF RIGHT( cBuffer, 2 ) == pCRLF // We need to remove this extra one!
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - 2 )
IF RIGHT( cBuffer, ::nCRLFLen ) == ::cCRLF // We need to remove this extra one!
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - ::nCRLFLen )
lWithCRLF := pTRUE
ENDIF
cBuffer := SUBSTR( cBuffer, RAT( pCRLF, cBuffer ) + 2 )
::nSkipLength := LEN( cBuffer ) + IF( lWithCRLF, 2, 0 )
cBuffer := SUBSTR( cBuffer, RAT( ::cCRLF, cBuffer ) + ::nCRLFLen )
::nSkipLength := LEN( cBuffer ) + IF( lWithCRLF, ::nCRLFLen, 0 )
::nposition := FSEEK( Self:nDosHandle, - ( LEN( cBuffer ) ), 2 )
IF lWithCRLF
::nposition := FSEEK( Self:nDosHandle, - 2, 1 )
::nposition := FSEEK( Self:nDosHandle, -( ::nCRLFLen), 1 )
ENDIF
ENDIF
@@ -453,11 +458,11 @@ METHOD WRITE( cChar ) CLASS FileBase
cBuffer := SPACE( ::nposition - nRead )
FREAD( Self:nDosHandle, @cBuffer, ( ::nposition - nRead ) )
IF RIGHT( cBuffer, 2 ) == pCRLF // with line already
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - 2 )
IF RIGHT( cBuffer, ::nCRLFLen ) == ::cCRLF // with line already
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - ::nCRLFLen )
lWithCRLF := pTRUE
ENDIF
nLocation := LEN( cBuffer ) - ( RAT( pCRLF, cBuffer ) )
nLocation := LEN( cBuffer ) - ( RAT( ::cCRLF, cBuffer ) )
ELSE
cBuffer := SPACE( pBUFFER_LENGTH )
@@ -467,7 +472,7 @@ METHOD WRITE( cChar ) CLASS FileBase
// Now, parse the string. and file
nLocation := AT( pCRLF, cBuffer )
nLocation := AT( ::cCRLF, 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
@@ -495,8 +500,8 @@ METHOD appendLine( cLine ) CLASS FileBase
IF LEN( cLine ) == 0 // Valid line
IF Self:noDosError() .AND. Self:nDosHandle > 0 // No error
IF !( pCRLF $ cLine ) // No CRLF, so add
cLIne += pCRLF
IF !( ::cCRLF $ cLine ) // No CRLF, so add
cLIne += ::cCRLF
ENDIF
FSEEK( Self:nDosHandle, 0, 2 )
FWRITE( Self:nDosHandle, cLine )
@@ -572,12 +577,12 @@ METHOD GOTO( nValue ) CLASS FileBase
lContinue := ( FREAD( Self:nDosHandle, @cBuffer, pBUFFER_LENGTH ) == ;
pBUFFER_LENGTH )
cBuffer := cLine + cBuffer
WHILE pCRLF $ cBuffer
WHILE ::cCRLF $ cBuffer
IF ++ nCount == nValue
lContinue := pFALSE
EXIT
ENDIF
cBuffer := SUBSTR( cBuffer, AT( pCRLF, cBuffer ) + 2 )
cBuffer := SUBSTR( cBuffer, AT( ::cCRLF, cBuffer ) + ::nCRLFLen )
ENDDO
cLine := cBuffer
ENDDO
@@ -619,11 +624,11 @@ METHOD BufferGet( lForward ) CLASS FileBase
cBuffer := SPACE( ::nposition - nRead )
FREAD( Self:nDosHandle, @cBuffer, ( ::nposition - nRead ) )
IF RIGHT( cBuffer, 2 ) == pCRLF // with line already
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - 2 )
IF RIGHT( cBuffer, ::nCRLFLen ) == ::cCRLF // with line already
cBuffer := LEFT( cBuffer, LEN( cBuffer ) - ::nCRLFLen )
lWithCRLF := pTRUE
ENDIF
nLocation := LEN( cBuffer ) - ( RAT( pCRLF, cBuffer ) )
nLocation := LEN( cBuffer ) - ( RAT( ::cCRLF, cBuffer ) )
ELSE
cBuffer := SPACE( pBUFFER_LENGTH )
@@ -633,7 +638,7 @@ METHOD BufferGet( lForward ) CLASS FileBase
// Now, parse the string. and file
nLocation := AT( pCRLF, cBuffer )
nLocation := AT( ::cCRLF, 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

@@ -392,11 +392,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"
@@ -1433,10 +1433,13 @@ STATIC FUNCTION GetItem( cItem, nCurdoc )
LOCAL nPos
LOCAL cCuritem
LOCAL lReturn
LOCAL lReturn:=.F.
LOCAL x
LOCAL xPos
xPos := aCurdoc[ nCurdoc ]
if nCurdoc <= len(aCurdoc)
xPos := aCurdoc[ nCurdoc ]
endif
nPos := ASCAN( xPos, { | x, y | UPPER( ALLTRIM( x ) ) == UPPER( ALLTRIM( cItem ) ) } )
IF nPos > 0
cCuritem := xPos[ nPos ]

View File

@@ -455,11 +455,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
@@ -486,9 +486,9 @@ 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 )
@@ -560,7 +560,7 @@ set console off
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 +576,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,7 +594,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})
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>" )
@@ -625,15 +625,15 @@ set console off
oHtm:Close()
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 +649,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")
@@ -789,11 +789,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,7 +802,7 @@ set console off
? 'ngxc comm.txt'
? 'Linking the Guide'
? 'ngxl '+cLinkName
? 'del ngi\*.*'
? 'del ngi/*.*'
? 'del *.ngo'
ENDIF