From d57bc5931c663337669e2515decfbc60eb05c1f3 Mon Sep 17 00:00:00 2001 From: Luiz Rafael Culik Date: Sat, 22 Jan 2000 16:05:06 +0000 Subject: [PATCH] *** empty log message *** --- harbour/ft_helpc.b32 | 6 +- harbour/gt.b32 | 12 +- harbour/source/tools/os2.prg | 230 +++++++++++++++++++++++++++++++++++ 3 files changed, 245 insertions(+), 3 deletions(-) create mode 100644 harbour/source/tools/os2.prg diff --git a/harbour/ft_helpc.b32 b/harbour/ft_helpc.b32 index 09885a8a8c..b3c80e8109 100644 --- a/harbour/ft_helpc.b32 +++ b/harbour/ft_helpc.b32 @@ -1,3 +1,7 @@ +# +# $Id: +# + .path.c = ngdoc .path.h = include .path.exe = bin @@ -14,7 +18,7 @@ ft_helpc.c : ft_helpc.prg bin\harbour $< /n /ongdoc\ /iinclude /p /DNANFOR ft_helpc.exe: ft_helpc.obj - echo -O2 > bld.32 + echo -O2 > bld.32 echo -engdoc\ft_helpc.exe >> bld.32 echo -Iinclude >> bld.32 echo ngdoc\ft_helpc.c >> bld.32 diff --git a/harbour/gt.b32 b/harbour/gt.b32 index 7de8343028..075825ab4c 100644 --- a/harbour/gt.b32 +++ b/harbour/gt.b32 @@ -16,7 +16,7 @@ lib\b32\hbgt.lib : \ ascpos.obj atdiff.obj chareven.obj charodd.obj chrcount.obj \ chrtotal.obj charmix.obj asciisum.obj chrfirst.obj io.obj numtxthu.obj numtxten.obj nconvert.obj \ rtf.obj strasint.obj strcount.obj strcspn.obj strdiff.obj strexpan.obj html.obj \ - strleft.obj strpbrk.obj strright.obj + strleft.obj strpbrk.obj strright.obj ng.obj os2.obj troff.obj ascpos.obj : ascpos.c extend.h hbdefs.h atdiff.obj : atdiff.c extend.h hbdefs.h @@ -41,11 +41,19 @@ nconvert.obj : nconvert.c extend.h hbdefs.h io.obj : io.c extend.h hbdefs.h rtf.obj : rtf.c extend.h hbdefs.h html.obj : html.c extend.h hbdefs.h +os2.obj : os2.c extend.h hbdefs.h +ng.obj : ng.c extend.h hbdefs.h +troff.obj : troff.c extend.h hbdefs.h + numtxthu.c : numtxthu.prg harbour.exe numtxten.c : numtxten.prg harbour.exe rtf.c : rtf.prg harbour.exe -html.c : html.prg harbour.exe +html.c : html.prg harbour.exe +os2.c : os2.prg harbour.exe +ng.c : ng.prg harbour.exe +troff.c : troff.rpg harbour.exe + .prg.c: bin\harbour $< /n /osource\tools\ /iinclude diff --git a/harbour/source/tools/os2.prg b/harbour/source/tools/os2.prg new file mode 100644 index 0000000000..c5e14e8c62 --- /dev/null +++ b/harbour/source/tools/os2.prg @@ -0,0 +1,230 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Norton Guide Support Code For FT_HELPC + * + * 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 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) 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 HRL + * and/or HVM code into it. + * + * 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 (or visit + * their web site at http://www.gnu.org/). + * + */ + +#define CRLF chr(13)+chr(10) + +#include 'hbclass.ch' + +*+北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北 +*+ +*+ Class TOs2 +*+ +*+北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北 +*+ +CLASS TOs2 + DATA cFile + DATA nHandle + DATA aLinkRef + DATA nRef + METHOD New( cFile ) + METHOD WritePar(cPar) + METHOD WriteLink(cLink) + METHOD ScanLink(cLink) + METHOD CLOSE() + METHOD WriteParBold(cPar) + METHOD WriteTitle(cTopic, cTitle ) + METHOD DostoOs2Text(cText) +ENDCLASS + METHOD New( cFile ) CLASS TOs2 + + IF Self:aLinkRef==NIL + Self:aLinkRef:={} + Self:nRef:=1 + ENDIF + + IF VALTYPE( cFile ) <> NIL .AND. VALTYPE( cFile ) == "C" + Self:cFile := LOWER( cFile ) + Self:nHandle := FCREATE( Self:cFile ) + ENDIF + + FWRITE( Self:nHandle, ':userdoc.'+CRLF) + + FWRITE( Self:nHandle, ':docprof toc=123456.'+CRLF) + +RETURN Self + +METHOD WritePar( cPar ) CLASS TOs2 + + FWRITE( Self:nHandle, ".br"+CRLF+Self:DostoOs2Text(ALLTRIM( cPar )) + CRLF ) + +RETURN Self + +METHOD WriteParBold( cPar ) CLASS TOs2 + + FWRITE( Self:nHandle, ':p.:hp2.' + ALLTRIM( cPar ) + CRLF +':ehp2.'+ CRLF) + +RETURN Self + +METHOD WriteTitle( cTopic, cTitle ) CLASS TOs2 + + LOCAL cTemp + LOCAL nPos + LOCAL cWrite + 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}) + ENDIF + // IF nItem==0 + // nItem:=Self:nRef + // ENDIF + + fWrite(Self:nHandle,':title.'+ALLTRIM(cTitle)+CRLF) + + fWrite(Self:nHandle,'.* FT_HelpC generated IPF Source File.'+CRLF) + + fWrite(Self:nHandle,'.* FT_HELPC Document Source Extractor, (c)2000 Luiz Rafael Culik.'+CRLF) + + + fWrite(Self:nHandle,':h1 res='+Alltrim(str(nItem))+'.'+cTopic+CRLF) + + + FWRITE( Self:nHandle,":p."+cTitle+CRLF) + + +RETURN Self + +METHOD CLOSE() CLASS TOs2 + + 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. + ELSE + 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) + + FWRITE( Self:nHandle,".br"+CRLF) + +RETURN Self + +METHOD ScanLink(cLink) CLASS TOs2 + + LOCAL nItem + LOCAL nReturn + + nItem:=ASCAN(Self:aLinkRef,{|a,b| a[1]==cLink}) + + IF nItem==0 + AADD(Self:aLinkRef,{cLink,Self:nRef}) + Self:nRef++ + ENDIF + +RETURN nItem + +METHOD DosToOs2Text(cText) CLASS TOs2 +LOCAL cReturn + +cReturn:=STRTRAN(cText,'"',"&cdq.") + +cReturn:=STRTRAN(cReturn,':',"&colon.") + +cReturn:=STRTRAN(cReturn,',',"&comma.") + +Return cReturn + + +/* $DOC$ + * $FUNCNAME$ + * TOs2() + * $CATEGORY$ + * Harbour Tools + * $ONELINER$ + * OS/2 Class + * $SYNTAX$ + * oNg:=TOs2():New() + * $ARGUMENTS$ + * Name of the IPF Source file to create + * $RETURNS$ + * An instance of the TOs2 Class + * $DESCRIPTION$ + * TOs2() is a class that create the Norton Guide Source + * Code of the same name you pass to the constructor. + * The class methods are as follows: + * New() Create a new instance of the THtml class. + * Close() Close the create file + * WriteTitle(,) Write the file title + * WritePar() Writes a paragrafer + * WriteParBold() Same as WritePar(), but the text is bold style. + * WriteLink() Write a link to another topic + * ScanLink() Scan the aLinkRef array for a valid topic + * DosToOs2Text() Convert a Dos string to a OS/2 String + * $EXAMPLES$ + * FUNCTION MAIN() + * + * LOCAL oNg + * + * oNg := TOs2():New( "ngi\harbour.ngi" ) + * oNg:WriteTitle( "Harbour Reference Guide" ) + * oNg:WritePar( "HARBOUR" ) + * oNg:WriteLink( "OverView" ) + * oNg:WriteLink( "License" ) + * + * oNg:WritePar( "See the Links Above" ) + * oNg:Close() + * RETURN Nil + * + * $TESTS$ + * + * $STATUS$ + * R + * $COMPLIANCE$ + * This is a new Harbour Tools class + * $PLATFORMS$ + * ALL + * $FILES$ + * + * $SEEALSO$ + * TCLASS() + * $END$ + */