Browse Source

* merged ide additions

peter 25 years ago
parent
commit
539c411afe
4 changed files with 359 additions and 145 deletions
  1. 53 121
      install/fpinst/Makefile
  2. 1 1
      install/fpinst/Makefile.fpc
  3. 299 21
      install/fpinst/install.pas
  4. 6 2
      install/fpinst/inststr.pas

+ 53 - 121
install/fpinst/Makefile

@@ -1,12 +1,12 @@
 #
-# Makefile generated by fpcmake v1.00 [2000/10/01]
+# Makefile generated by fpcmake v1.00 [2000/07/11]
 #
 
 defaultrule: all
 
 #####################################################################
 # Autodetect OS (Linux or Dos or Windows NT)
-# define inUnix when running under Unix (Linux,FreeBSD)
+# define inlinux when running under linux
 # define inWinNT when running under WinNT
 #####################################################################
 
@@ -23,18 +23,22 @@ nopwd:
 	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
 	@exit
 else
-inUnix=1
+inlinux=1
 endif
 else
 PWD:=$(firstword $(PWD))
 endif
 
 # Detect NT - NT sets OS to Windows_NT
-# Detect OS/2 - OS/2 has OS2_SHELL defined
-ifndef inUnix
+ifndef inlinux
 ifeq ($(OS),Windows_NT)
 inWinNT=1
-else
+endif
+endif
+
+# Detect OS/2 - OS/2 has OS2_SHELL defined
+ifndef inlinux
+ifndef inWinNT
 ifdef OS2_SHELL
 inOS2=1
 endif
@@ -42,14 +46,14 @@ endif
 endif
 
 # The extension of executables
-ifdef inUnix
-SRCEXEEXT=
+ifdef inlinux
+EXEEXT=
 else
-SRCEXEEXT=.exe
+EXEEXT=.exe
 endif
 
 # The path which is searched separated by spaces
-ifdef inUnix
+ifdef inlinux
 SEARCHPATH=$(subst :, ,$(PATH))
 else
 SEARCHPATH=$(subst ;, ,$(PATH))
@@ -72,11 +76,15 @@ ifndef FPC
 ifdef PP
 FPC=$(PP)
 else
+ifdef inOS2
+FPC=ppos2
+else
 FPC=ppc386
 endif
 endif
-override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
-override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+endif
+override FPC:=$(subst $(EXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(EXEEXT)
 
 # Target OS
 ifndef OS_TARGET
@@ -133,7 +141,7 @@ endif
 
 # Detect FPCDIR
 ifeq ($(FPCDIR),wrong)
-ifdef inUnix
+ifdef inlinux
 override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
 ifeq ($(wildcard $(FPCDIR)/units),)
 override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
@@ -209,6 +217,7 @@ ZIPTARGET=install
 
 # Directories
 
+override NEEDUNITDIR=../../ide/text
 ifndef TARGETDIR
 TARGETDIR=.
 endif
@@ -232,7 +241,7 @@ INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall
 ifndef ECHO
 ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
 ifeq ($(ECHO),)
-ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
 ifeq ($(ECHO),)
 ECHO:=echo
 ECHOE:=echo
@@ -273,7 +282,7 @@ endif
 
 # To install files
 ifndef INSTALL
-ifdef inUnix
+ifdef inlinux
 INSTALL:=install -m 644
 else
 INSTALL:=$(COPY)
@@ -282,7 +291,7 @@ endif
 
 # To install programs
 ifndef INSTALLEXE
-ifdef inUnix
+ifdef inlinux
 INSTALLEXE:=install -m 755
 else
 INSTALLEXE:=$(COPY)
@@ -291,7 +300,7 @@ endif
 
 # To make a directory.
 ifndef MKDIR
-ifdef inUnix
+ifdef inlinux
 MKDIR:=install -m 755 -d
 else
 MKDIR:=ginstall -m 755 -d
@@ -315,7 +324,7 @@ LD=ld
 endif
 
 # ppas.bat / ppas.sh
-ifdef inUnix
+ifdef inlinux
 PPAS=ppas.sh
 else
 ifdef inOS2
@@ -326,7 +335,7 @@ endif
 endif
 
 # ldconfig to rebuild .so cache
-ifdef inUnix
+ifdef inlinux
 LDCONFIG=ldconfig
 else
 LDCONFIG=
@@ -334,7 +343,7 @@ endif
 
 # ppumove
 ifndef PPUMOVE
-PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
 ifeq ($(PPUMOVE),)
 PPUMOVE=
 else
@@ -345,7 +354,7 @@ export PPUMOVE
 
 # ppufiles
 ifndef PPUFILES
-PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
 ifeq ($(PPUFILES),)
 PPUFILES=
 else
@@ -364,7 +373,7 @@ ifeq ($(OS_TARGET),win32)
 UPXPROG:=1
 endif
 ifdef UPXPROG
-UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
 ifeq ($(UPXPROG),)
 UPXPROG=
 else
@@ -378,7 +387,7 @@ export UPXPROG
 
 # ZipProg, you can't use Zip as the var name (PFV)
 ifndef ZIPPROG
-ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
 ifeq ($(ZIPPROG),)
 ZIPPROG=
 else
@@ -392,7 +401,7 @@ ZIPEXT=.zip
 
 # Tar
 ifndef TARPROG
-TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(EXEEXT),$(SEARCHPATH))))
 ifeq ($(TARPROG),)
 TARPROG=
 else
@@ -415,7 +424,6 @@ endif
 
 # Default needed extensions (Go32v2,Linux)
 LOADEREXT=.as
-EXEEXT=.exe
 PPLEXT=.ppl
 PPUEXT=.ppu
 OEXT=.o
@@ -444,18 +452,9 @@ endif
 
 # Linux
 ifeq ($(OS_TARGET),linux)
-EXEEXT=
-HASSHAREDLIB=1
 FPCMADE=fpcmade.lnx
 endif
 
-# Linux
-ifeq ($(OS_TARGET),freebsd)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.freebsd
-endif
-
 # Win32
 ifeq ($(OS_TARGET),win32)
 PPUEXT=.ppw
@@ -616,30 +615,9 @@ endif
 # Default Directories
 #####################################################################
 
-# Linux and freebsd use unix dirs with /usr/bin, /usr/lib
-# When zipping use the target as default, when normal install then
-# use the source os as default
-ifdef ZIPNAME
-# Zipinstall
-ifeq ($(OS_TARGET),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),freebsd)
-UNIXINSTALLDIR=1
-endif
-else
-# Normal install
-ifeq ($(OS_SOURCE),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),freebsd)
-UNIXINSTALLDIR=1
-endif
-endif
-
 # set the prefix directory where to install everything
 ifndef PREFIXINSTALLDIR
-ifdef UNIXINSTALLDIR
+ifdef inlinux
 PREFIXINSTALLDIR=/usr
 else
 PREFIXINSTALLDIR=/pp
@@ -659,7 +637,7 @@ export DESTZIPDIR
 
 # set the base directory where to install everything
 ifndef BASEINSTALLDIR
-ifdef UNIXINSTALLDIR
+ifdef inlinux
 BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
 else
 BASEINSTALLDIR=$(PREFIXINSTALLDIR)
@@ -668,7 +646,7 @@ endif
 
 # set the directory where to install the binaries
 ifndef BININSTALLDIR
-ifdef UNIXINSTALLDIR
+ifdef inlinux
 BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
 else
 BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
@@ -685,7 +663,7 @@ endif
 
 # Where to install shared libraries
 ifndef LIBINSTALLDIR
-ifdef UNIXINSTALLDIR
+ifdef inlinux
 LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
 else
 LIBINSTALLDIR=$(UNITINSTALLDIR)
@@ -694,7 +672,7 @@ endif
 
 # Where the source files will be stored
 ifndef SOURCEINSTALLDIR
-ifdef UNIXINSTALLDIR
+ifdef inlinux
 SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
 else
 SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
@@ -706,7 +684,7 @@ endif
 
 # Where the doc files will be stored
 ifndef DOCINSTALLDIR
-ifdef UNIXINSTALLDIR
+ifdef inlinux
 DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
 else
 DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
@@ -716,7 +694,7 @@ endif
 # Where to install the examples, under linux we use the doc dir
 # because the copytree command will create a subdir itself
 ifndef EXAMPLEINSTALLDIR
-ifdef UNIXINSTALLDIR
+ifdef inlinux
 EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
 else
 EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
@@ -740,7 +718,7 @@ REDIRFILE=log
 endif
 
 ifdef REDIR
-ifndef inUnix
+ifndef inlinux
 override FPC=redir -eo $(FPC)
 endif
 # set the verbosity to max
@@ -787,7 +765,7 @@ endif
 
 # Debug
 ifdef DEBUG
-override FPCOPT+=-gl -dDEBUG
+override FPCOPT+=-g -dDEBUG
 endif
 
 # Release mode (strip, optimize and don't load ppc386.cfg)
@@ -823,27 +801,9 @@ ifdef UNITSDIR
 override FPCOPT+=-Fu$(UNITSDIR)
 endif
 
-# Target dirs and the prefix to use for clean/install
+# Target dirs
 ifdef TARGETDIR
 override FPCOPT+=-FE$(TARGETDIR)
-ifeq ($(TARGETDIR),.)
-override TARGETDIRPREFIX=
-else
-override TARGETDIRPREFIX=$(TARGETDIR)/
-endif
-endif
-ifdef UNITTARGETDIR
-override FPCOPT+=-FU$(UNITTARGETDIR)
-ifeq ($(UNITTARGETDIR),.)
-override UNITTARGETDIRPREFIX=
-else
-override UNITTARGETDIRPREFIX=$(TARGETDIR)/
-endif
-else
-ifdef TARGETDIR
-override UNITTARGETDIR=$(TARGETDIR)
-override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
-endif
 endif
 
 # Add commandline options last so they can override
@@ -877,14 +837,11 @@ endif
 override COMPILER:=$(FPC) $(FPCOPT)
 
 # also call ppas if with command option -s
-# but only if the OS_SOURCE and OS_TARGE are equal
 ifeq (,$(findstring -s ,$(COMPILER)))
 EXECPPAS=
 else
-ifeq ($(OS_SOURCE),$(OS_TARGET))
 EXECPPAS:=@$(PPAS)
 endif
-endif
 
 #####################################################################
 # Standard rules
@@ -930,12 +887,11 @@ info: fpc_info
 
 ifdef EXEOBJECTS
 override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS))
-override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS)))
+override EXEOFILES=$(addsuffix $(OEXT),$(EXEOBJECTS))
 
 override ALLTARGET+=fpc_exes
 override INSTALLEXEFILES+=$(EXEFILES)
 override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)
-
 endif
 
 fpc_exes: $(EXEFILES)
@@ -956,11 +912,6 @@ fpc_all: fpc_packages $(FPCMADE)
 fpc_debug:
 	$(MAKE) all DEBUG=1
 
-# Search paths for .ppu if targetdir is set
-ifdef UNITTARGETDIR
-vpath %$(PPUEXT) $(UNITTARGETDIR)
-endif
-
 # General compile rules, available for both possible PASEXT
 
 .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
@@ -1002,7 +953,7 @@ fpc_smart:
 	$(MAKE) all LINKSMART=1 CREATESMART=1
 
 fpc_shared: all
-ifdef HASSHAREDLIB
+ifdef inlinux
 ifndef LIBNAME
 	@$(ECHO) "LIBNAME not set"
 else
@@ -1023,17 +974,11 @@ override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
 endif
 
 ifdef INSTALLPPUFILES
-override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
 ifdef PPUFILES
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
 else
-INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))))
+INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
-override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))
-endif
-
-ifdef INSTALLEXEFILES
-override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
 endif
 
 fpc_showinstall: $(SHOWINSTALLTARGET)
@@ -1047,7 +992,7 @@ ifneq ($(INSTALLPPULINKFILES),)
 endif
 ifneq ($(wildcard $(LIBFULLNAME)),)
 	@$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
-ifdef HASSHAREDLIB
+ifdef inlinux
 	@$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
 endif
 endif
@@ -1075,7 +1020,7 @@ endif
 ifneq ($(wildcard $(LIBFULLNAME)),)
 	$(MKDIR) $(LIBINSTALLDIR)
 	$(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
-ifdef inUnix
+ifdef inlinux
 	ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
 endif
 endif
@@ -1136,7 +1081,7 @@ endif
 
 # Temporary path to pack a file
 ifndef PACKDIR
-ifndef inUnix
+ifndef inlinux
 PACKDIR=$(BASEDIR)/pack_tmp
 else
 PACKDIR=/tmp/fpc-pack
@@ -1152,7 +1097,7 @@ endif
 
 # Use tar by default under linux
 ifndef USEZIP
-ifdef inUnix
+ifdef inlinux
 USETAR=1
 endif
 endif
@@ -1189,23 +1134,16 @@ fpc_zipexampleinstall:
 
 .PHONY: fpc_clean fpc_cleanall fpc_distclean
 
-ifdef EXEFILES
-override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
-endif
-
 ifdef EXTRACLEANUNITS
 override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
 endif
 
 ifdef CLEANPPUFILES
-override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
-# Get the .o and .a files created for the units
 ifdef PPUFILES
 CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
 else
-CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
+CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)))
 endif
-override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
 endif
 
 fpc_clean: $(CLEANTARGET)
@@ -1219,7 +1157,7 @@ ifneq ($(CLEANPPULINKFILES),)
 	-$(DEL) $(CLEANPPULINKFILES)
 endif
 ifdef CLEANRSTFILES
-	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+	-$(DEL) $(CLEANRSTFILES)
 endif
 ifdef EXTRACLEANFILES
 	-$(DEL) $(EXTRACLEANFILES)
@@ -1231,13 +1169,7 @@ endif
 
 fpc_distclean: fpc_clean
 
-# Also run clean first if targetdir is set. Unittargetdir is always
-# set if targetdir or unittargetdir is specified
-ifdef UNITTARGETDIR
-TARGETDIRCLEAN=fpc_clean
-endif
-
-fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
+fpc_cleanall: $(CLEANTARGET)
 ifdef CLEANEXEFILES
 	-$(DEL) $(CLEANEXEFILES)
 endif

+ 1 - 1
install/fpinst/Makefile.fpc

@@ -23,7 +23,7 @@ packages=api fv
 [dirs]
 fpcdir=..
 targetdir=.
-
+unitdir=../../ide/text
 
 [rules]
 installer.pas: install.pas

+ 299 - 21
install/fpinst/install.pas

@@ -70,11 +70,12 @@ program install;
 {$IFDEF DLL}
      unzipdll,
 {$ENDIF}
-     app,dialogs,views,menus,msgbox,colortxt,tabs,inststr,scroll;
+     app,dialogs,views,menus,msgbox,colortxt,tabs,inststr,scroll,
+     HelpCtx,WHTMLScn;
 
 
   const
-     installerversion='1.02';
+     installerversion='1.0.2';
 
 
      {$ifdef TP}lfnsupport=false;{$endif}
@@ -83,11 +84,15 @@ program install;
      maxpackages=20;
      maxdefcfgs=1024;
 
+     HTMLIndexExt = '.htx';
      CfgExt = '.dat';
 
      MaxStatusPos = 4;
      StatusChars: string [MaxStatusPos] = '/-\|';
      StatusPos: byte = 1;
+     { this variable is set to true if an ide is installed }
+     haside : boolean = false;
+     hashtmlhelp : boolean = false;
 
 {$IFDEF LINUX}
      DirSep='/';
@@ -121,6 +126,8 @@ program install;
        name     : string[12];
        binsub   : string[40];
        ppc386   : string[20];
+       defidecfgfile,
+       defideinifile,
        defcfgfile : string[12];
        include  : boolean;
        filechk  : string[40];
@@ -128,15 +135,23 @@ program install;
        package  : array[1..maxpackages] of tpackage;
      end;
 
+     tcfgarray = array[1..maxdefcfgs] of pstring;
+
      cfgrec=record
        title    : string[80];
        version  : string[20];
        language : string[30];
+       helpidx,
+       docsub,
        basepath : DirStr;
        packs    : word;
        pack     : array[1..maxpacks] of tpack;
+       defideinis,
+       defidecfgs,
        defcfgs  : longint;
-       defcfg   : array[1..maxdefcfgs] of pstring;
+       defideini,
+       defidecfg,
+       defcfg   : tcfgarray;
      end;
 
      datarec=packed record
@@ -168,6 +183,19 @@ program install;
         constructor init;
      end;
 
+     PFPHTMLFileLinkScanner = ^TFPHTMLFileLinkScanner;
+     TFPHTMLFileLinkScanner = object(THTMLFileLinkScanner)
+        function    CheckURL(const URL: string): boolean; virtual;
+        function    CheckText(const Text: string): boolean; virtual;
+        procedure   ProcessDoc(Doc: PHTMLLinkScanFile); virtual;
+     end;
+
+     phtmlindexdialog = ^thtmlindexdialog;
+     thtmlindexdialog = object(tdialog)
+       text : pstatictext;
+       constructor init(var Bounds: TRect; ATitle: TTitleStr);
+     end;
+
      tapp = object(tapplication)
          procedure initmenubar;virtual;
          procedure handleevent(var event : tevent);virtual;
@@ -393,12 +421,176 @@ program install;
        GetProgDir := D;
     end;
 
+  function RTrim(const S: string): string;
+  var
+    i : longint;
+  begin
+    i:=length(s);
+    while (i>0) and (s[i]=' ') do
+     dec(i);
+    RTrim:=Copy(s,1,i);
+  end;
+
+  function LTrim(const S: string): string;
+  var
+    i : longint;
+  begin
+    i:=1;
+    while (i<length(s)) and (s[i]=' ') do
+     inc(i);
+    LTrim:=Copy(s,i,255);
+  end;
+
+  function Trim(const S: string): string;
+  begin
+    Trim:=RTrim(LTrim(S));
+  end;
+
+  function CompareText(S1, S2: string): integer;
+  var R: integer;
+  begin
+    S1:=Upcase(S1);
+    S2:=Upcase(S2);
+    if S1<S2 then R:=-1 else
+    if S1>S2 then R:= 1 else
+    R:=0;
+    CompareText:=R;
+  end;
+
+  function ExtOf(const S: string): string;
+  var D: DirStr; E: ExtStr; N: NameStr;
+  begin
+    FSplit(S,D,N,E);
+    ExtOf:=E;
+  end;
+
+  function DirAndNameOf(const S: string): string;
+  var D: DirStr; E: ExtStr; N: NameStr;
+  begin
+    FSplit(S,D,N,E);
+    DirAndNameOf:=D+N;
+  end;
+
+{*****************************************************************************
+                          HTML-Index Generation
+*****************************************************************************}
+  var
+     indexdlg : phtmlindexdialog;
+
+  constructor thtmlindexdialog.Init(var Bounds: TRect; ATitle: TTitleStr);
+    var
+      r : trect;
+    begin
+      inherited init(bounds,atitle);
+      R.Assign (4, 2,bounds.B.X-Bounds.A.X-2, 4);
+      text:=new(pstatictext,init(r,'Please wait ...'));
+      insert(text);
+    end;
+
+  procedure TFPHTMLFileLinkScanner.ProcessDoc(Doc: PHTMLLinkScanFile);
+
+    var
+       oldtext : pstring;
+    begin
+       oldtext:=indexdlg^.text^.text;
+       indexdlg^.text^.text:=newstr('Processing '+Doc^.GetDocumentURL);
+       indexdlg^.text^.drawview;
+       inherited ProcessDoc(Doc);
+       disposestr(indexdlg^.text^.text);
+       indexdlg^.text^.text:=oldtext;
+       indexdlg^.text^.drawview;
+    end;
+
+  function TFPHTMLFileLinkScanner.CheckURL(const URL: string): boolean;
+  var OK: boolean;
+  const HTTPPrefix = 'http:';
+        FTPPrefix  = 'ftp:';
+  begin
+    OK:=inherited CheckURL(URL);
+    if OK then OK:=DirAndNameOf(URL)<>'';
+    if OK then OK:=CompareText(copy(ExtOf(URL),1,4),'.HTM')=0;
+    if OK then OK:=CompareText(copy(URL,1,length(HTTPPrefix)),HTTPPrefix)<>0;
+    if OK then OK:=CompareText(copy(URL,1,length(FTPPrefix)),FTPPrefix)<>0;
+    CheckURL:=OK;
+  end;
+
+  function TFPHTMLFileLinkScanner.CheckText(const Text: string): boolean;
+  var OK: boolean;
+      S: string;
+  begin
+    S:=Trim(Text);
+    OK:=(S<>'') and (copy(S,1,1)<>'[');
+    CheckText:=OK;
+  end;
+
+  procedure writehlpindex(filename : string);
+
+    var
+       LS : PFPHTMLFileLinkScanner;
+       BS : PBufStream;
+       S : String;
+       Re : Word;
+       params : array[0..0] of pointer;
+       dir    : searchrec;
+       r : trect;
+
+    begin
+       S:='HTML Index';
+       r.assign(10,10,70,15);
+       indexdlg:=new(phtmlindexdialog,init(r,'Creating HTML index file, please wait ...'));
+       desktop^.insert(indexdlg);
+       New(LS, Init);
+       LS^.ProcessDocument(FileName,[soSubDocsOnly]);
+       if LS^.GetDocumentCount=0 then
+         begin
+           params[0]:=@filename;
+           MessageBox('Problem creating help index %1, abording',@params,
+                  mferror+mfyesbutton+mfnobutton);
+         end
+       else
+         begin
+           FileName:=DirAndNameOf(FileName)+HTMLIndexExt;
+           findfirst(filename,AnyFile,dir);
+           if doserror=0 then
+             begin
+                params[0]:=@filename;
+                Re:=MessageBox('Help index %s already exists, overwrite it?',@params,
+                  mfinformation+mfyesbutton+mfnobutton);
+             end;
+           if Re<>cmNo then
+           begin
+             New(BS, Init(FileName, stCreate, 4096));
+             if Assigned(BS)=false then
+               begin
+                  MessageBox('Error while writing help index! '+
+                    'No help index is created',@params,
+                    mferror+mfokbutton);
+                  Re:=cmCancel;
+               end
+             else
+               begin
+                 LS^.StoreDocuments(BS^);
+                 if BS^.Status<>stOK then
+                   begin
+                      MessageBox('Error while writing help index!'#13+
+                        'No help index is created',@params,
+                        mferror+mfokbutton);
+                      Re:=cmCancel;
+                   end;
+                 Dispose(BS, Done);
+               end;
+           end;
+         end;
+       Dispose(LS, Done);
+       desktop^.delete(indexdlg);
+       dispose(indexdlg,done);
+    end;
 
 {*****************************************************************************
                           Writing of ppc386.cfg
 *****************************************************************************}
 
-  procedure writedefcfg(const fn:string);
+  procedure writedefcfg(const fn:string;const cfgdata : tcfgarray;count : longint);
     var
       t      : text;
       i      : longint;
@@ -432,10 +624,10 @@ program install;
          MessageBox(msg_problems_writing_cfg,@params,mfinformation+mfokbutton);
          exit;
        end;
-      for i:=1 to cfg.defcfgs do
-       if assigned(cfg.defcfg[i]) then
+      for i:=1 to count do
+       if assigned(cfgdata[i]) then
          begin
-           s:=cfg.defcfg[i]^;
+           s:=cfgdata[i]^;
            Replace(s,'$1',data.basepath);
 
            { error msg file entry? }
@@ -574,7 +766,10 @@ program install;
       EMXName: array [1..4] of char = 'EMX'#0;
 {$ENDIF}
     begin
-      YB := 14;
+      if haside then
+        YB := 15
+      else
+        YB := 14;
 
 {$IFNDEF LINUX}
       s:='';
@@ -624,17 +819,24 @@ program install;
           S := str_libpath+'''' + S + '\'+str_dll+''''
          else
           S := str_extend_libpath+'''' + S + '\'+str_dll+'''';
-         R.Assign (2, YB - 13, 64, YB - 11);
+         R.Assign (2, YB - 14, 64, YB - 12);
          P := New (PStaticText, Init (R, S));
          Insert (P);
        end;
   {$ENDIF}
 {$ENDIF}
 
-      R.Assign(2, YB - 11, 64, YB - 10);
+      R.Assign(2, YB - 13, 64, YB - 12);
       P:=new(pstatictext,init(r,str_to_compile+''''+cfg.pack[1].ppc386+str_file2+''''));
       insert(P);
 
+      if haside then
+        begin
+           R.Assign(2, YB - 12, 64, YB - 10);
+           P:=new(pstatictext,init(r,str_start_ide));
+           insert(P);
+        end;
+
       R.Assign (29, YB - 9, 39, YB - 7);
       Control := New (PButton, Init (R,str_ok, cmOK, bfDefault));
       Insert (Control);
@@ -981,6 +1183,29 @@ program install;
        DSize,Space,ASpace : longint;
        S: DirStr;
 {$endif}
+
+    procedure doconfigwrite;
+
+      var
+         i : longint;
+
+      begin
+         for i:=1 to cfg.packs do
+           if cfg.pack[i].defcfgfile<>'' then
+             writedefcfg(data.basepath+cfg.pack[i].binsub+DirSep+cfg.pack[i].defcfgfile,cfg.defcfg,cfg.defcfgs);
+         if haside then
+           begin
+              for i:=1 to cfg.packs do
+                if cfg.pack[i].defidecfgfile<>'' then
+                 writedefcfg(data.basepath+cfg.pack[i].binsub+DirSep+cfg.pack[i].defidecfgfile,cfg.defidecfg,cfg.defidecfgs);
+              for i:=1 to cfg.packs do
+                if cfg.pack[i].defideinifile<>'' then
+                 writedefcfg(data.basepath+cfg.pack[i].binsub+DirSep+cfg.pack[i].defideinifile,cfg.defideini,cfg.defideinis);
+              if hashtmlhelp then
+                writehlpindex(data.basepath+DirSep+cfg.DocSub+DirSep+cfg.helpidx);
+           end;
+      end;
+
     begin
       data.basepath:=cfg.basepath;
       data.cfgval:=0;
@@ -1054,11 +1279,7 @@ program install;
                      result:=messagebox(msg_no_components_selected,nil,
                                                 mfinformation+mfyesbutton+mfnobutton);
                      if (result=cmYes) and createinstalldir(data.basepath) then
-                      begin
-                        for i:=1 to cfg.packs do
-                         if cfg.pack[i].defcfgfile<>'' then
-                          writedefcfg(data.basepath+cfg.pack[i].binsub+DirSep+cfg.pack[i].defcfgfile);
-                      end;
+                       doconfigwrite;
                      exit;
                    end
                   else
@@ -1093,11 +1314,7 @@ program install;
 
     { write config }
       if (data.cfgval and 1)<>0 then
-       begin
-         for i:=1 to cfg.packs do
-          if cfg.pack[i].defcfgfile<>'' then
-           writedefcfg(data.basepath+cfg.pack[i].binsub+DirSep+cfg.pack[i].defcfgfile);
-       end;
+        doconfigwrite;
 
     { show end message }
       p3:=new(penddialog,init);
@@ -1179,6 +1396,12 @@ program install;
                else
                 if item='BASEPATH' then
                  cfg.basepath:=s
+               else
+                if item='HELPIDX' then
+                   cfg.helpidx:=s
+               else
+                if item='DOCSUB' then
+                   cfg.docsub:=s
                else
                 if item='DEFAULTCFG' then
                  begin
@@ -1193,6 +1416,32 @@ program install;
                       end;
                    until false;
                  end
+                else if item='DEFAULTIDECFG' then
+                 begin
+                   repeat
+                     readln(t,s);
+                     if upper(s)='ENDCFG' then
+                      break;
+                     if cfg.defidecfgs<maxdefcfgs then
+                      begin
+                        inc(cfg.defidecfgs);
+                        cfg.defidecfg[cfg.defidecfgs]:=newstr(s);
+                      end;
+                   until false;
+                 end
+                else if item='DEFAULTIDEINI' then
+                 begin
+                   repeat
+                     readln(t,s);
+                     if upper(s)='ENDCFG' then
+                      break;
+                     if cfg.defideinis<maxdefcfgs then
+                      begin
+                        inc(cfg.defideinis);
+                        cfg.defideini[cfg.defideinis]:=newstr(s);
+                      end;
+                   until false;
+                 end
                else
                 if item='PACK' then
                  begin
@@ -1214,6 +1463,26 @@ program install;
                     end;
                    cfg.pack[cfg.packs].defcfgfile:=s
                  end
+               else
+                if item='IDECFGFILE' then
+                 begin
+                   if cfg.packs=0 then
+                    begin
+                      writeln('No pack set');
+                      halt(1);
+                    end;
+                   cfg.pack[cfg.packs].defidecfgfile:=s
+                 end
+               else
+                if item='IDEINIFILE' then
+                 begin
+                   if cfg.packs=0 then
+                    begin
+                      writeln('No pack set');
+                      halt(1);
+                    end;
+                   cfg.pack[cfg.packs].defideinifile:=s
+                 end
                else
                 if item='PPC386' then
                  begin
@@ -1252,6 +1521,10 @@ program install;
                       writeln('No pack set');
                       halt(1);
                     end;
+                   if copy(s,1,3)='ide' then
+                     haside:=true;
+                   if copy(s,1,7)='doc-htm' then
+                     hashtmlhelp:=true;
                    with cfg.pack[cfg.packs] do
                     begin
                       j:=pos(',',s);
@@ -1407,6 +1680,8 @@ var
    i : longint;
 
 begin
+   { register objects for help streaming }
+   RegisterWHTMLScan;
 {$ifdef FPC}
 {$ifdef win32}
   Dos.Exec(GetEnv('COMSPEC'),'/C echo This dummy call gets the mouse to become visible');
@@ -1483,7 +1758,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.9  2000-10-08 18:43:17  hajny
+  Revision 1.10  2000-10-11 15:57:47  peter
+    * merged ide additions
+
+  Revision 1.9  2000/10/08 18:43:17  hajny
     * the language dialog repaired
 
   Revision 1.8  2000/09/24 10:52:36  peter

+ 6 - 2
install/fpinst/inststr.pas

@@ -49,7 +49,7 @@ unit inststr;
 
        msg_nocomponents = 'No components selected.'#13#13'Abort installation?';
        msg_overwrite_cfg = 'Config %s already exists, continue writing default config?';
-       msg_problems_writing_cfg = #3'Default config not written.'#13#3'%s'#13#3'couldn''t be created';
+       msg_problems_writing_cfg = #3'A config not written.'#13#3'%s'#13#3'couldn''t be created';
        msg_problems_create_dir = 'A file with the name chosen as the installation '+
                                  'directory exists already. Cannot create this directory!';
        msg_no_components_selected = 'No components selected.'#13#13'Create a configfile ?';
@@ -81,6 +81,7 @@ unit inststr;
        str_is_not = 'is not';
        str_might_not_be = 'might not be';
        str_to_compile = 'To compile files enter ';
+       str_start_ide = 'To start the IDE (Integrated Development Environment) type ''fp'' at a command line prompt';
        str_libpath = 'and your LIBPATH with ';
        str_extend_libpath = 'Extend your LIBPATH with ';
        str_dll = 'dll';
@@ -93,7 +94,10 @@ unit inststr;
 end.
 {
   $Log$
-  Revision 1.3  2000-09-22 12:15:49  florian
+  Revision 1.4  2000-10-11 15:57:47  peter
+    * merged ide additions
+
+  Revision 1.3  2000/09/22 12:15:49  florian
     + support of Russian (Windows)
 
   Revision 1.2  2000/09/22 11:07:51  florian