From f6f06d1f1b1a2c747bb8086bb4dd982a595de650 Mon Sep 17 00:00:00 2001 From: Luiz Rafael Culik Date: Mon, 24 Apr 2000 09:51:50 +0000 Subject: [PATCH] See changelog 20000423 22:00 gmt -3 --- harbour/utils/hbdoc/Makefile | 1 - harbour/utils/hbdoc/genhtm.prg | 83 +++++++++------- harbour/utils/hbdoc/hbdoc.prg | 69 ++++++++++---- harbour/utils/hbdoc/hrbtools.rsp | 15 +-- harbour/utils/hbdoc/os2.prg | 156 +++++++++++++++++++------------ 5 files changed, 201 insertions(+), 123 deletions(-) diff --git a/harbour/utils/hbdoc/Makefile b/harbour/utils/hbdoc/Makefile index 51a0b57bb7..7e495fb28e 100644 --- a/harbour/utils/hbdoc/Makefile +++ b/harbour/utils/hbdoc/Makefile @@ -32,7 +32,6 @@ LIBS=\ debug \ vm \ rtl \ - lang \ rdd \ rtl \ vm \ diff --git a/harbour/utils/hbdoc/genhtm.prg b/harbour/utils/hbdoc/genhtm.prg index b70ead6609..0e5ab02352 100644 --- a/harbour/utils/hbdoc/genhtm.prg +++ b/harbour/utils/hbdoc/genhtm.prg @@ -48,7 +48,7 @@ #define MODULELINE 12 #define LINELINE 14 #define ERRORLINE 20 -#define LONGLINE 100 +#define LONGLINE 600 #define LONGONELINE 86 MEMVAR aDirList MEMVAR aDocInfo @@ -208,8 +208,8 @@ FUNCTION ProcessWww() IF AT( cDoc, cBuffer ) > 0 IF lDoc - WRITE_ERROR( cDoc + " encountered during extraction of Doc" ; - + " at line" + STR( nLinecnt, 5, 0 ),,,, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( cDoc + " encountered during extraction of Doc" ; +// + " at line" + STR( nLinecnt, 5, 0 ),,,, aDirList[ i, F_NAME ] ) ENDIF lDoc := .T. cBuffer := TRIM( SUBSTR( ReadLN( @lEof ), ; @@ -219,8 +219,8 @@ FUNCTION ProcessWww() nMode := D_IGNORE ELSEIF AT( cClassDoc, cBuffer ) > 0 IF lClassDoc - WRITE_ERROR( cDoc + " encountered during extraction of Doc" ; - + " at line" + STR( nLinecnt, 5, 0 ),,,, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( cDoc + " encountered during extraction of Doc" ; + // + " at line" + STR( nLinecnt, 5, 0 ),,,, aDirList[ i, F_NAME ] ) ENDIF lClassDoc := .T. cBuffer := TRIM( SUBSTR( ReadLN( @lEof ), ; @@ -232,17 +232,17 @@ FUNCTION ProcessWww() ELSEIF AT( cEnd, cBuffer ) > 0 nCurDoc ++ IF .NOT. lDoc .AND. !lClassDoc - WRITE_ERROR( cEnd + " encountered outside of Doc area at line" ; - + STR( nLinecnt, 5, 0 ),,,, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( cEnd + " encountered outside of Doc area at line" ; + // + STR( nLinecnt, 5, 0 ),,,, aDirList[ i, F_NAME ] ) ELSE // Add a new entry to our list of files IF EMPTY( cCategory ) - WRITE_ERROR( "Blank Category",,,, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "Blank Category",,,, aDirList[ i, F_NAME ] ) cCategory := "Unknown" ENDIF IF EMPTY( cFuncName ) - WRITE_ERROR( "Blank Function Name",,,, aDirList[ i, F_NAME ] ) + // WRITE_ERROR( "Blank Function Name",,,, aDirList[ i, F_NAME ] ) cFuncName := "Unknown" ENDIF AADD( aDocInfo, { cCategory, cFuncName, cOneLine, cFileName } ) @@ -343,7 +343,7 @@ FUNCTION ProcessWww() ENDIF IF ohtm:nHandle < 1 ? "Error creating", cFileName, ".htm" - WRITE_ERROR( "Error creating",,,, cFileName + ".htm" ) +// WRITE_ERROR( "Error creating",,,, cFileName + ".htm" ) ENDIF ELSEIF (AT( cdata, cBuffer ) > 0 .and. GetItem( cBuffer, nCurdoc ) ).OR. (AT( cmethod, cBuffer ) > 0 .and. GetItem( cBuffer, nCurdoc ) ) @@ -392,8 +392,8 @@ FUNCTION ProcessWww() nLineCnt ++ cOneLine := ALLTRIM( SUBSTR( cBuffer, nCommentLen ) ) IF LEN( cOneLine ) > LONGONELINE - WRITE_ERROR( "OneLine", cOneLine, nLineCnt, LONGONELINE, ; - aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "OneLine", cOneLine, nLineCnt, LONGONELINE, ; +// aDirList[ i, F_NAME ] ) ENDIF nMode := D_ONELINE @@ -545,8 +545,8 @@ end cBuffer := STRTRAN( cBuffer, "\" + DELIM, DELIM ) IF nMode = D_SYNTAX IF LEN( cBuffer ) > LONGLINE - WRITE_ERROR( "Syntax", cBuffer, nLineCnt, ; - LONGLINE, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "Syntax", cBuffer, nLineCnt, ; + // LONGLINE, aDirList[ i, F_NAME ] ) ENDIF lBlankLine := EMPTY( cBuffer ) IF lAddBlank @@ -556,8 +556,8 @@ end ELSEIF nMode = D_ARG IF LEN( cBuffer ) > LONGLINE - WRITE_ERROR( "Arguments", cBuffer, nLineCnt, ; - LONGLINE, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "Arguments", cBuffer, nLineCnt, ; + // LONGLINE, aDirList[ i, F_NAME ] ) ENDIF lBlankLine := EMPTY( cBuffer ) IF lAddBlank @@ -567,8 +567,8 @@ end prochtmdesc( cbuffer, oHtm, "Arguments" ) ELSEIF nMode = D_NORMAL IF LEN( cBuffer ) > LONGLINE - WRITE_ERROR( "General", cBuffer, nLineCnt, ; - LONGLINE, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "General", cBuffer, nLineCnt, ; + // LONGLINE, aDirList[ i, F_NAME ] ) ENDIF lBlankLine := EMPTY( cBuffer ) @@ -580,15 +580,15 @@ end ProcHtmDesc( cBuffer, oHtm ) ELSEIF nMode = D_EXAMPLE IF LEN( cBuffer ) > LONGLINE - WRITE_ERROR( "General", cBuffer, nLineCnt, ; - LONGLINE, aDirList[ i, F_NAME ] ) + // WRITE_ERROR( "General", cBuffer, nLineCnt, ; +// LONGLINE, aDirList[ i, F_NAME ] ) ENDIF lBlankLine := EMPTY( cBuffer ) prochtmdesc( cBuffer, oHtm, "Example" ) ELSEIF nMode = D_DESCRIPTION IF LEN( cBuffer ) > LONGLINE - WRITE_ERROR( "General", cBuffer, nLineCnt, ; - LONGLINE, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "General", cBuffer, nLineCnt, ; + // LONGLINE, aDirList[ i, F_NAME ] ) ENDIF lBlankLine := EMPTY( cBuffer ) prochtmdesc( cBuffer, oHtm, "Description" ) @@ -605,8 +605,8 @@ end ENDIF ELSEIF nMode = D_DATALINK IF LEN( cBuffer ) > LONGLINE - WRITE_ERROR( "General", cBuffer, nLineCnt, ; - LONGLINE, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "General", cBuffer, nLineCnt, ; + // LONGLINE, aDirList[ i, F_NAME ] ) ENDIF lBlankLine := EMPTY( cBuffer ) IF lAddBlank @@ -617,8 +617,8 @@ end ELSEIF nMode = D_METHODLINK IF LEN( cBuffer ) > LONGLINE - WRITE_ERROR( "General", cBuffer, nLineCnt, ; - LONGLINE, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "General", cBuffer, nLineCnt, ; + // LONGLINE, aDirList[ i, F_NAME ] ) ENDIF lBlankLine := EMPTY( cBuffer ) IF lAddBlank @@ -629,8 +629,8 @@ end ELSEIF nMode = D_COMPLIANCE IF LEN( cBuffer ) > LONGLINE - WRITE_ERROR( "General", cBuffer, nLineCnt, ; - LONGLINE, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "General", cBuffer, nLineCnt, ; + // LONGLINE, aDirList[ i, F_NAME ] ) ENDIF lBlankLine := EMPTY( cBuffer ) prochtmdesc( cBuffer, oHtm, "Compliance" ) @@ -646,9 +646,9 @@ end // unknown data from somewhere - WRITE_ERROR( "Unknown Data Type " + cBuffer,, ; - nLineCnt, ; - LONGONELINE, aDirList[ i, F_NAME ] ) +// WRITE_ERROR( "Unknown Data Type " + cBuffer,, ; +// nLineCnt, ; +// LONGONELINE, aDirList[ i, F_NAME ] ) ENDIF ENDIF @@ -858,7 +858,7 @@ FUNCTION FormatHtmBuff( cBuffer, cStyle, oHtm ) ELSEIF cStyle == 'Arguments' nPos := 0 - IF AT( "", cReturn ) > 0 + IF AT( "", cReturn ) > 0 .and. at('',cReturn)=0 cReturn := STRTRAN( cReturn, "", "" ) cReturn := STRTRAN( cReturn, "", "" ) cReturn := ALLTRIM( cReturn ) @@ -870,7 +870,24 @@ FUNCTION FormatHtmBuff( cBuffer, cStyle, oHtm ) cOldLine := STRTRAN( cOldLine, ">", ">" ) lArgBold := .T. ENDIF + elseif AT( "", cReturn ) > 0 .and. at('',cReturn)>0 + cReturn := STRTRAN( cReturn, "", "" ) + cReturn := STRTRAN( cReturn, "", "" ) + cReturn := ALLTRIM( cReturn ) + nPos := AT( '', cReturn ) + cOldLine := LEFT( cReturn, nPos + 3 ) + cReturn := STRTRAN( cReturn, cOldLine, "" ) + IF AT( "@", cOldLine ) > 0 .OR. AT( "()", cOldLine ) > 0 .OR. AT( "<", cOldLine ) > 0 .OR. AT( "_", cOldLine ) > 0 + cOldLine := STRTRAN( cOldLine, "", "" ) + cOldLine := STRTRAN( cOldLine, "", "" ) + cOldLine := STRTRAN( cOldLine, "<", "<" ) + cOldLine := STRTRAN( cOldLine, ">", ">" ) + lArgBold := .T. + ENDIF + ENDIF + + DO WHILE !lEndBuffer cLine := TRIM( SUBSTR( ReadLN( @lEof ), nCommentLen ) ) @@ -1073,7 +1090,7 @@ FUNCTION ProchtmDesc( cBuffer, oHtm, cStyle ) cBuffer := STRTRAN( cBuffer, "", "" ) cBuffer := STRTRAN( cBuffer, "", "" ) - oHtm:WriteText( "
" ) + oHtm:WriteText( "
" )
          oHtm:WritePar( cBuffer )
       ENDIF
       DO WHILE !lendFixed
diff --git a/harbour/utils/hbdoc/hbdoc.prg b/harbour/utils/hbdoc/hbdoc.prg
index 27acfae3a7..f5e673efa1 100644
--- a/harbour/utils/hbdoc/hbdoc.prg
+++ b/harbour/utils/hbdoc/hbdoc.prg
@@ -153,6 +153,7 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
    LOCAL aName         // Tokenized name
    LOCAL nLen          // Length of the token array
    LOCAL oHtm
+   LOCAL oHtm1
    LOCAL ppp
    LOCAL cTemp
    PUBLIC theHandle
@@ -435,22 +436,26 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile )
       FCLOSE( nHpj )
    ELSEIF lWWW
 
-//      oHtm := THTML():New( "htm\harbour.htm" )
       asort(adocinfo,,,{|x,y| x[1]+x[2]
") + ohtm:WriteText('

'+adocinfo[1,1]+'


') + ohtm:WriteText("
    ") + for ppp:=1 to len(adocinfo) if citem ==adocinfo[ppp,1] oHtm:Writelink(adocinfo[ppp,4],UpperLower(adocinfo[ppp,2])) else - ohtm:WriteText("
") + ohtm:WriteText("") ohtm:close() - citem:=adocinfo[ppp,1] - ohtm:=THTML():new('htm\hb'+citem+'.htm') - ohtm:WriteText("
    ") + citem:=adocinfo[ppp,1] + ohtm:=THTML():new('htm\hb'+strtran(adocinfo[ppp,1]," ","")+'.htm') + ohtm:WriteText('

    '+adocinfo[ppp,1]+'


    ') + ohtm:WriteText("
      ") oHtm:Writelink(adocinfo[ppp,4],UpperLower(adocinfo[ppp,2])) endif next @@ -459,18 +464,43 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile ) endif enddo ohtm:close() - /* - oHtm:WriteTitle( "Harbour Reference Guide" ) + oHtm1 := THTML():New( "htm\harbour.htm" ) + oHtm1:WriteTitle( "Harbour Reference Guide" ) + oHtm1:WriteText( "

      Harbour Reference Guide

      " ) + oHtm1:WriteText( "

      HARBOUR

      " + hb_osnEwline() + '
        ' ) + oHtm1:WriteLink( "overview", UpperLower( "Harbour Read me" ) ) + oHtm1:WriteLink( "license", UpperLower( "Harbour License" ) ) + oHtm1:WriteLink( "http://www.gnu.org/copyleft/gpl.html", "GNU License" ) + oHtm1:WriteLink( "compileroptions.htm", "Compiler Options" ) + oHtm1:WriteLink( "harbourextension.htm", "Harbour Extensions" ) + oHtm1:WriteText( "
      " ) + oHtm1:WriteText( "

      Alphabetical list of functions by Categorie

      " ) + ohtm1:writetext('
        ') - oHtm:WriteText( "

        Harbour Reference Guide

        " ) - oHtm:WriteText( "

        HARBOUR

        " + hb_osnEwline() + '
          ' ) - oHtm:WriteLink( "overview", UpperLower( "Harbour Read me" ) ) - oHtm:WriteLink( "license", UpperLower( "Harbour License" ) ) - oHtm:WriteLink( "http://www.gnu.org/copyleft/gpl.html", "GNU License" ) - oHtm:WriteLink( "compileroptions.htm", "Compiler Options" ) - oHtm:WriteText( "
        " ) - oHtm:WriteText( "

        Alphabetical list of functions

        " ) - oHtm:WriteText( "
          " ) + do while .t. + citem:=alltrim(rtrim(ltrim(adocinfo[1,1]))) + // citem:=strtran(adocinfo[1,1]," ","") + ohtm1:WriteLink('hb'+strtran(adocinfo[1,1]," ","")+'.htm',UpperLower(cItem)) + for ppp:=1 to len(adocinfo) + + if citem<>adocinfo[ppp,1] + citem:=alltrim(rtrim(ltrim(adocinfo[ppp,1]))) + ohtm1:WriteLink('hb'+strtran(adocinfo[ppp,1]," ","")+'.htm',UpperLower(cItem)) + +// citem:=strtran(adocinfo[ppp,1]," ","") + endif + next + if ppp>len(adocinfo) + exit + endif + enddo + + ohtm1:writetext('
        ') + ohtm1:close() +/* + oHtm := THTML():New( "htm\harbour.htm" ) + +/* ASORT( awww,,, { | x, y | x[ 1 ] < y[ 1 ] } ) FOR nPos := 1 TO LEN( aWww ) @@ -554,7 +584,7 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile ) ? 'ngxc funcn_.txt ' ? 'ngxc comm.txt' ? 'Linking the Guide' - ? 'ngxl harbour.lnk' + ? 'ngxl '+cLinkName ? 'del ngi\*.*' ? 'del *.ngo' ENDIF @@ -573,7 +603,7 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile ) // Send out list of authors - @ INFILELINE, 0 CLEAR TO INFILELINE, MAXCOL() +/* @ INFILELINE, 0 CLEAR TO INFILELINE, MAXCOL() @ INFILELINE, 30 SAY "Sorting Author file" FOR i := 1 TO LEN( aAuthorList ) @@ -650,6 +680,7 @@ FUNCTION MAIN( cFlags, cLinkName, cAtFile ) SET CONSOLE ON SET ALTERNATE OFF SET ALTERNATE TO +*/ @ MAXROW(), 0 SAY "Execute ASSEMBL.BAT to compile and link Guides" // Return to caller diff --git a/harbour/utils/hbdoc/hrbtools.rsp b/harbour/utils/hbdoc/hrbtools.rsp index 4d5cbbc801..6cb57a61ac 100644 --- a/harbour/utils/hbdoc/hrbtools.rsp +++ b/harbour/utils/hbdoc/hrbtools.rsp @@ -8,13 +8,6 @@ ..\..\doc\en\dir.txt ..\..\doc\en\error.txt ..\..\doc\en\file.txt -..\..\doc\en\ht_class.txt -..\..\doc\en\ht_conv.txt -..\..\doc\en\ht_dbf.txt -..\..\doc\en\ht_doc.txt -..\..\doc\en\ht_file.txt -..\..\doc\en\ht_gt.txt -..\..\doc\en\ht_str.txt ..\..\doc\en\hvm.txt ..\..\doc\en\input.txt ..\..\doc\en\license.txt @@ -37,7 +30,7 @@ ..\..\doc\en\tlabel.txt ..\..\doc\en\treport.txt ..\..\doc\en\var.txt -..\..\doc\subcodes.txt -..\..\doc\harbext.txt -..\..\doc\gnulice.txt -..\..\doc\compiler.txt +..\..\doc\en\subcodes.txt +..\..\doc\en\harbext.txt +..\..\doc\en\gnulice.txt +..\..\doc\en\compiler.txt diff --git a/harbour/utils/hbdoc/os2.prg b/harbour/utils/hbdoc/os2.prg index fb8a404cba..16484bb6d7 100644 --- a/harbour/utils/hbdoc/os2.prg +++ b/harbour/utils/hbdoc/os2.prg @@ -1,3 +1,41 @@ +*+²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +*+ +*+ Source Module => C:\HARB\UTILS\HBDOC\OS2.PRG +*+ +*+ Click! is a Clipper/Xbase++ source code reformatter. +*+ +*+ 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: Class TOs2 +*+ +*+ Reformatted by Click! 2.03 on Apr-10-2000 at 10:28 am +*+ +*+²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² + /* * $Id$ */ @@ -43,31 +81,31 @@ *+ *+ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ *+ - CLASS TOs2 + DATA cFile DATA nHandle DATA aLinkRef DATA nRef METHOD New( cFile ) - METHOD WritePar(cPar) - METHOD WriteLink(cLink) - METHOD ScanLink(cLink) - - METHOD WriteJumpLink( cLink,cName,cText ) - METHOD Close() - METHOD WriteText(cPar) - METHOD WriteParBold(cPar) - METHOD WriteTitle(cTopic, cTitle ) - METHOD DostoOs2Text(cText) - METHOD WriteJumpTitle( cTitle, cTopic ) + METHOD WritePar( cPar ) + METHOD WriteLink( cLink ) + METHOD ScanLink( cLink ) + + METHOD WriteJumpLink( cLink, cName, cText ) + METHOD CLOSE() + METHOD WriteText( cPar ) + METHOD WriteParBold( cPar ) + METHOD WriteTitle( cTopic, cTitle ) + METHOD DostoOs2Text( cText ) + METHOD WriteJumpTitle( cTitle, cTopic ) ENDCLASS METHOD New( cFile ) CLASS TOs2 - IF Self:aLinkRef==NIL - Self:aLinkRef:={} - Self:nRef:=1 + IF Self:aLinkRef == NIL + Self:aLinkRef := {} + Self:nRef := 1 ENDIF IF VALTYPE( cFile ) <> NIL .AND. VALTYPE( cFile ) == "C" @@ -75,14 +113,14 @@ METHOD New( cFile ) CLASS TOs2 Self:nHandle := FCREATE( Self:cFile ) ENDIF - FWRITE( Self:nHandle, ':userdoc.'+CRLF) + FWRITE( Self:nHandle, ':userdoc.' + CRLF ) - FWRITE( Self:nHandle, ':docprof toc=123456.'+CRLF) - fWrite(Self:nHandle,':title.'+"Harbour Reference Guide"+CRLF) + FWRITE( Self:nHandle, ':docprof toc=123456.' + CRLF ) + FWRITE( Self:nHandle, ':title.' + "Harbour Reference Guide" + CRLF ) - fWrite(Self:nHandle,'.* HBDOC generated IPF Source File.'+CRLF) + FWRITE( Self:nHandle, '.* HBDOC generated IPF Source File.' + CRLF ) - fWrite(Self:nHandle,'.* HBDOC Document Source Extractor, (c)1999-2000 Luiz Rafael Culik.'+CRLF) + FWRITE( Self:nHandle, '.* HBDOC Document Source Extractor, (c)1999-2000 Luiz Rafael Culik.' + CRLF ) RETURN Self @@ -92,15 +130,15 @@ METHOD WritePar( cPar ) CLASS TOs2 RETURN Self -method WriteText(cPar) CLASS TOs2 +METHOD WriteText( cPar ) CLASS TOs2 - FWRITE( Self:nHandle, cPar + CRLF ) + FWRITE( Self:nHandle, cPar + CRLF ) -Return Self +RETURN Self METHOD WriteParBold( cPar ) CLASS TOs2 - FWRITE( Self:nHandle, ':p.:hp2.' + ALLTRIM( cPar ) + CRLF +':ehp2.'+ CRLF) + FWRITE( Self:nHandle, ':p.:hp2.' + ALLTRIM( cPar ) + CRLF + ':ehp2.' + CRLF ) RETURN Self @@ -112,73 +150,72 @@ METHOD WriteTitle( cTopic, cTitle ) CLASS TOs2 LOCAL nItem cTopic := ALLTRIM( cTopic ) - IF Self:Scanlink(cTopic) ==0 - nItem:=ASCAN(Self:aLinkRef,{|a| a[1]==cTopic}) - ELSE // Just in case that nItem>0 so the Link is already referenced - nItem:=ASCAN(Self:aLinkRef,{|a| a[1]==cTopic}) + IF Self:Scanlink( cTopic ) == 0 + nItem := ASCAN( Self:aLinkRef, { | a | a[ 1 ] == cTopic } ) + ELSE // Just in case that nItem>0 so the Link is already referenced + nItem := ASCAN( Self:aLinkRef, { | a | a[ 1 ] == cTopic } ) ENDIF - - - fWrite(Self:nHandle,':h1 res='+Alltrim(str(nItem))+'.'+cTopic+CRLF) - fWrite(Self:nHandle,':i1 id='+UPPER(cTopic)+"."+UPPER(cTopic)+CRLF) - FWRITE( Self:nHandle,":p."+cTitle+CRLF) - + FWRITE( Self:nHandle, ':h1 res=' + ALLTRIM( STR( nItem ) ) + '.' + cTopic + CRLF ) + FWRITE( Self:nHandle, ':i1 id=' + UPPER( cTopic ) + "." + UPPER( cTopic ) + CRLF ) + FWRITE( Self:nHandle, ":p." + cTitle + CRLF ) RETURN Self METHOD CLOSE() CLASS TOs2 - FWRITE( Self:nHandle,':euserdoc.'+CRLF) + FWRITE( Self:nHandle, ':euserdoc.' + CRLF ) FCLOSE( Self:nHandle ) RETURN Self METHOD WriteLink( cLink ) CLASS TOs2 + LOCAL nItem - if Self:Scanlink(cLink) ==0 - nItem:=ASCAN(Self:aLinkRef,{|a| a[1]==cLink}) // Again. + IF Self:Scanlink( cLink ) == 0 + nItem := ASCAN( Self:aLinkRef, { | a | a[ 1 ] == cLink } ) // Again. ELSE - nItem:=ASCAN(Self:aLinkRef,{|a,b| a[1]==cLink}) + nItem := ASCAN( Self:aLinkRef, { | a, b | a[ 1 ] == cLink } ) - endif - - IF nItem=0 - nItem:=Self:nRef ENDIF - FWRITE( Self:nHandle, ":link reftype=hd res="+ALLTRIM(STR(nItem))+"."+Self:aLinkRef[nItem,1]+":elink."+CRLF) + IF nItem = 0 + nItem := Self:nRef + ENDIF - FWRITE( Self:nHandle,".br"+CRLF) + FWRITE( Self:nHandle, ":link reftype=hd res=" + ALLTRIM( STR( nItem ) ) + "." + Self:aLinkRef[ nItem, 1 ] + ":elink." + CRLF ) + + FWRITE( Self:nHandle, ".br" + CRLF ) RETURN Self -METHOD ScanLink(cLink) CLASS TOs2 +METHOD ScanLink( cLink ) CLASS TOs2 LOCAL nItem LOCAL nReturn - nItem:=ASCAN(Self:aLinkRef,{|a,b| a[1]==cLink}) + nItem := ASCAN( Self:aLinkRef, { | a, b | a[ 1 ] == cLink } ) - IF nItem==0 - AADD(Self:aLinkRef,{cLink,Self:nRef}) - Self:nRef++ + IF nItem == 0 + AADD( Self:aLinkRef, { cLink, Self:nRef } ) + Self:nRef ++ ENDIF RETURN nItem -METHOD DosToOs2Text(cText) CLASS TOs2 +METHOD DosToOs2Text( cText ) CLASS TOs2 + LOCAL cReturn - cReturn := STRTRAN(cText,'"',"&cdq.") - cReturn := STRTRAN(cReturn,':',"&colon.") - cReturn := STRTRAN(cReturn,',',"&comma.") + cReturn := STRTRAN( cText, '"', "&cdq." ) + cReturn := STRTRAN( cReturn, ':', "&colon." ) + cReturn := STRTRAN( cReturn, ',', "&comma." ) -Return cReturn +RETURN cReturn -METHOD WriteJumpTitle( cTitle, cTopic ) class TOs2 +METHOD WriteJumpTitle( cTitle, cTopic ) CLASS TOs2 LOCAL cTemp LOCAL nPos @@ -186,18 +223,19 @@ METHOD WriteJumpTitle( cTitle, cTopic ) class TOs2 nPos := AT( "()", cTitle ) - cTopic := ALLTRIM( HB_OEMTOANSI(cTopic )) + cTopic := ALLTRIM( HB_OEMTOANSI( cTopic ) ) - cWrite := ':fn id='+cTopic+'.' + cWrite := ':fn id=' + cTopic + '.' FWRITE( Self:nHandle, cWrite ) Self:WriteParBold( cTopic ) RETURN Self -METHOD WriteJumpLink( cLink,cText ) class TOs2 +METHOD WriteJumpLink( cLink, cText ) CLASS TOs2 - FWRITE( Self:nHandle, " :link refid="+aLLTRIM( HB_OEMTOANSI(cLink) ) +"reftype=fn."+ cLink+":elink." +cText+ CRLF ) + FWRITE( Self:nHandle, " :link refid=" + ALLTRIM( HB_OEMTOANSI( cLink ) ) + "reftype=fn." + cLink + ":elink." + cText + CRLF ) RETURN Self +*+ EOF: OS2.PRG