diff --git a/.gitattributes b/.gitattributes index 9666f0a40d..3ca636bbf6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -148,6 +148,7 @@ ide/include/ide.inc svneol=native#text/pascal ide/include/linux/lazconf.inc svneol=native#text/pascal ide/include/netbsd/lazconf.inc svneol=native#text/pascal ide/include/win32/lazconf.inc svneol=native#text/pascal +ide/inputhistory.pas svneol=native#text/pascal ide/insertwatch.lrs svneol=native#text/pascal ide/keymapping.pp svneol=native#text/pascal ide/lazarus.pp svneol=native#text/pascal diff --git a/components/codetools/Makefile b/components/codetools/Makefile index 88b6a3fe78..31e54dd818 100644 --- a/components/codetools/Makefile +++ b/components/codetools/Makefile @@ -1,7 +1,8 @@ # -# Don't edit, this file is generated by FPCMake Version 1.1 [2001/12/31] +# Don't edit, this file is generated by FPCMake Version 1.1 [2002/03/28] # default: all +MAKEFILETARGETS=linux override PATH:=$(subst \,/,$(PATH)) ifeq ($(findstring ;,$(PATH)),) inUnix=1 @@ -13,10 +14,7 @@ PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) -nopwd: - @echo You need the GNU utils package to use this Makefile! - @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip - @exit +$(error You need the GNU utils package to use this Makefile) else PWD:=$(firstword $(PWD)) SRCEXEEXT= @@ -70,6 +68,22 @@ endif else BASEDIR=. endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif ifndef FPC ifdef PP FPC=$(PP) @@ -93,23 +107,45 @@ ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif export FPC FPC_VERSION +unexport CHECKDEPEND ALLDEPENDENCIES +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +COMPILERINFO:=$(shell $(FPC) -iSP -iTP -iSO -iTO) +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 1,$(COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 2,$(COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 3,$(COMPILERINFO)) +endif +ifndef OS_TARGET +OS_TARGET:=$(word 4,$(COMPILERINFO)) +endif +else +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif -ifndef CPU_SOURCE -CPU_SOURCE:=$(shell $(FPC) -iSP) +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) endif ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif -ifndef OS_SOURCE -OS_SOURCE:=$(shell $(FPC) -iSO) endif FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) ifneq ($(FULL_TARGET),$(FULL_SOURCE)) CROSSCOMPILE=1 endif +ifeq ($(findstring makefile,$(MAKECMDGOALS)),) +ifeq ($(findstring $(OS_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(OS_TARGET), please run fpcmake first) +endif +endif export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE CROSSCOMPILE ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) @@ -119,6 +155,14 @@ endif else override FPCDIR=wrong endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -150,10 +194,11 @@ endif else UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) endif -PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) override PACKAGE_NAME=codetools override PACKAGE_VERSION=0.8a override TARGET_UNITS+=allcodetoolunits +override TARGET_IMPLICITUNITS+=codetoolsstrconsts avl_tree basiccodetools codecache sourcelog customcodetool pascalparsertool finddeclarationtool stdcodetools methodjumptool eventcodetool codecompletiontool codeatom codetree definetemplates expreval keywordfunclists linkscanner sourcechanger fileprocs override COMPILER_OPTIONS+=-gl override COMPILER_UNITDIR+=. override COMPILER_UNITTARGETDIR+=../units @@ -191,6 +236,11 @@ UNIXINSTALLDIR=1 endif endif ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR INSTALL_PREFIX=/usr/local else @@ -202,6 +252,9 @@ endif endif endif export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif ifndef DIST_DESTDIR DIST_DESTDIR:=$(BASEDIR) endif @@ -248,41 +301,43 @@ endif endif ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR +ifdef BSDhier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif ifdef INSTALL_FPCPACKAGE -ifdef BSDhier -INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/share/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) else -INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) endif else -ifdef BSDhier -INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/share/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -else -INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -endif +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif else ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif else -INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source endif endif endif ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif ifdef INSTALL_FPCPACKAGE -ifdef BSDhier -INSTALL_DOCDIR:=$(INSTALL_PREFIX)/share/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) -endif -else -ifdef BSDhier -INSTALL_DOCDIR:=$(INSTALL_PREFIX)/share/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -else -INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -endif +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif else ifdef INSTALL_FPCPACKAGE @@ -403,11 +458,13 @@ PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 AOUTEXT=.out -SMARTEXT=.so +SMARTEXT=.sl2 +STATICLIBPREFIX= STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 ZIPSUFFIX=emx +ECHO=echo endif ifeq ($(OS_TARGET),amiga) EXEEXT= @@ -679,6 +736,7 @@ else TAROPT=vz TAREXT=.tar.gz endif +override REQUIRE_PACKAGES=rtl fcl ifeq ($(OS_TARGET),linux) REQUIRE_PACKAGES_RTL=1 REQUIRE_PACKAGES_PASZLIB=1 @@ -687,76 +745,19 @@ REQUIRE_PACKAGES_FCL=1 REQUIRE_PACKAGES_MYSQL=1 REQUIRE_PACKAGES_IBASE=1 endif -ifeq ($(OS_TARGET),go32v2) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_FCL=1 -endif -ifeq ($(OS_TARGET),win32) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_FCL=1 -REQUIRE_PACKAGES_MYSQL=1 -REQUIRE_PACKAGES_IBASE=1 -endif -ifeq ($(OS_TARGET),os2) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_FCL=1 -endif -ifeq ($(OS_TARGET),freebsd) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_INET=1 -REQUIRE_PACKAGES_FCL=1 -REQUIRE_PACKAGES_MYSQL=1 -REQUIRE_PACKAGES_IBASE=1 -endif -ifeq ($(OS_TARGET),beos) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_FCL=1 -endif -ifeq ($(OS_TARGET),netbsd) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_INET=1 -REQUIRE_PACKAGES_FCL=1 -endif -ifeq ($(OS_TARGET),amiga) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_FCL=1 -endif -ifeq ($(OS_TARGET),atari) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_FCL=1 -endif -ifeq ($(OS_TARGET),sunos) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_FCL=1 -endif -ifeq ($(OS_TARGET),qnx) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_FCL=1 -endif ifdef REQUIRE_PACKAGES_RTL -PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/$(OS_TARGET)/Makefile.fpc,$(PACKAGESDIR)))))) ifneq ($(PACKAGEDIR_RTL),) -PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) -ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_rtl -package_rtl: - $(MAKE) -C $(PACKAGEDIR_RTL) all -endif ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) else UNITDIR_RTL=$(PACKAGEDIR_RTL) endif +ifdef CHECKDEPEND +$(PACKAGEDIR_RTL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE) +endif else PACKAGEDIR_RTL= UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) @@ -771,19 +772,18 @@ override COMPILER_UNITDIR+=$(UNITDIR_RTL) endif endif ifdef REQUIRE_PACKAGES_PASZLIB -PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))) +PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR)))))) ifneq ($(PACKAGEDIR_PASZLIB),) -PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB)) -ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_paszlib -package_paszlib: - $(MAKE) -C $(PACKAGEDIR_PASZLIB) all -endif ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),) UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET) else UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PASZLIB)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PASZLIB) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PASZLIB)/$(FPCMADE) +endif else PACKAGEDIR_PASZLIB= UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) @@ -798,19 +798,18 @@ override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) endif endif ifdef REQUIRE_PACKAGES_INET -PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))) +PACKAGEDIR_INET:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR)))))) ifneq ($(PACKAGEDIR_INET),) -PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET)) -ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_inet -package_inet: - $(MAKE) -C $(PACKAGEDIR_INET) all -endif ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) else UNITDIR_INET=$(PACKAGEDIR_INET) endif +ifdef CHECKDEPEND +$(PACKAGEDIR_INET)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_INET) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_INET)/$(FPCMADE) +endif else PACKAGEDIR_INET= UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) @@ -825,19 +824,18 @@ override COMPILER_UNITDIR+=$(UNITDIR_INET) endif endif ifdef REQUIRE_PACKAGES_FCL -PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))) +PACKAGEDIR_FCL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR)))))) ifneq ($(PACKAGEDIR_FCL),) -PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL)) -ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_fcl -package_fcl: - $(MAKE) -C $(PACKAGEDIR_FCL) all -endif ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),) UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET) else UNITDIR_FCL=$(PACKAGEDIR_FCL) endif +ifdef CHECKDEPEND +$(PACKAGEDIR_FCL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_FCL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL)/$(FPCMADE) +endif else PACKAGEDIR_FCL= UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) @@ -852,19 +850,18 @@ override COMPILER_UNITDIR+=$(UNITDIR_FCL) endif endif ifdef REQUIRE_PACKAGES_MYSQL -PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))) +PACKAGEDIR_MYSQL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR)))))) ifneq ($(PACKAGEDIR_MYSQL),) -PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL)) -ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_mysql -package_mysql: - $(MAKE) -C $(PACKAGEDIR_MYSQL) all -endif ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),) UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET) else UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) endif +ifdef CHECKDEPEND +$(PACKAGEDIR_MYSQL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_MYSQL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_MYSQL)/$(FPCMADE) +endif else PACKAGEDIR_MYSQL= UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) @@ -879,19 +876,18 @@ override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) endif endif ifdef REQUIRE_PACKAGES_IBASE -PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))) +PACKAGEDIR_IBASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR)))))) ifneq ($(PACKAGEDIR_IBASE),) -PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE)) -ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_ibase -package_ibase: - $(MAKE) -C $(PACKAGEDIR_IBASE) all -endif ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),) UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET) else UNITDIR_IBASE=$(PACKAGEDIR_IBASE) endif +ifdef CHECKDEPEND +$(PACKAGEDIR_IBASE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_IBASE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_IBASE)/$(FPCMADE) +endif else PACKAGEDIR_IBASE= UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) @@ -905,7 +901,6 @@ ifdef UNITDIR_IBASE override COMPILER_UNITDIR+=$(UNITDIR_IBASE) endif endif -.PHONY: package_rtl package_paszlib package_inet package_fcl package_mysql package_ibase ifndef NOCPUDEF override FPCOPTDEF=$(CPU_TARGET) endif @@ -1025,24 +1020,26 @@ endif ifdef TARGET_UNITS override ALLTARGET+=fpc_units override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS)) -override INSTALLPPUFILES+=$(UNITPPUFILES) -override CLEANPPUFILES+=$(UNITPPUFILES) +override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) endif fpc_units: $(UNITPPUFILES) ifdef TARGET_RSTS override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) override CLEANRSTFILES+=$(RSTFILES) endif -.PHONY: fpc_packages fpc_all fpc_smart fpc_debug -$(FPCMADE): $(ALLTARGET) +.PHONY: fpc_all fpc_smart fpc_debug fpc_release +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) @$(ECHOREDIR) Compiled > $(FPCMADE) -fpc_packages: $(COMPILEPACKAGES) -fpc_all: fpc_packages $(FPCMADE) +fpc_all: $(FPCMADE) fpc_smart: $(MAKE) all LINKSMART=1 CREATESMART=1 fpc_debug: $(MAKE) all DEBUG=1 -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp .rc .res %$(PPUEXT): %.pp $(COMPILER) $< $(EXECPPAS) @@ -1055,6 +1052,8 @@ fpc_debug: %$(EXEEXT): %.pas $(COMPILER) $< $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) @@ -1062,6 +1061,9 @@ vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) ifdef INSTALL_UNITS override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif ifdef INSTALLPPUFILES override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) @@ -1110,7 +1112,7 @@ ifdef INSTALL_FILES endif fpc_sourceinstall: distclean $(MKDIR) $(INSTALL_SOURCEDIR) - $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) ifdef HASEXAMPLES $(MKDIR) $(INSTALL_EXAMPLEDIR) @@ -1242,12 +1244,13 @@ ifdef CLEANEXEFILES endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) ifdef AOUTEXT -$(DEL) *$(AOUTEXT) endif -.PHONY: fpc_info -fpc_info: +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: @$(ECHO) @$(ECHO) == Package info == @$(ECHO) Package Name..... $(PACKAGE_NAME) @@ -1261,11 +1264,13 @@ fpc_info: @$(ECHO) Target CPU... $(CPU_TARGET) @$(ECHO) Source OS.... $(OS_SOURCE) @$(ECHO) Target OS.... $(OS_TARGET) - @$(ECHO) Full Target.. $(FULL_SOURCE) - @$(ECHO) Full Source.. $(FULL_TARGET) + @$(ECHO) Full Source.. $(FULL_SOURCE) + @$(ECHO) Full Target.. $(FULL_TARGET) @$(ECHO) @$(ECHO) == Directory info == @$(ECHO) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) @$(ECHO) Basedir......... $(BASEDIR) @$(ECHO) FPCDir.......... $(FPCDIR) @$(ECHO) CrossBinDir..... $(CROSSBINDIR) @@ -1295,12 +1300,13 @@ fpc_info: @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) Target Loaders...... $(TARGET_LOADERS) - @$(ECHO) Target Units........ $(TARGET_UNITS) - @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) - @$(ECHO) Target Dirs......... $(TARGET_DIRS) - @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) - @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) @$(ECHO) @$(ECHO) Clean Units......... $(CLEAN_UNITS) @$(ECHO) Clean Files......... $(CLEAN_FILES) @@ -1327,8 +1333,25 @@ fpc_info: @$(ECHO) Dist destination dir. $(DIST_DESTDIR) @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs debug: fpc_debug smart: fpc_smart +release: fpc_release examples: shared: install: fpc_install @@ -1343,7 +1366,8 @@ clean: fpc_clean distclean: fpc_distclean cleanall: fpc_cleanall info: fpc_info -.PHONY: debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info +makefiles: fpc_makefiles +.PHONY: debug smart release examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif diff --git a/components/codetools/Makefile.fpc b/components/codetools/Makefile.fpc index c4d86553a9..e0ebfd5074 100644 --- a/components/codetools/Makefile.fpc +++ b/components/codetools/Makefile.fpc @@ -14,7 +14,7 @@ options=-gl [target] units=allcodetoolunits -implicitunits=avl_tree basiccodetools codecache sourcelog \ +implicitunits=codetoolsstrconsts avl_tree basiccodetools codecache sourcelog \ customcodetool pascalparsertool finddeclarationtool stdcodetools \ methodjumptool eventcodetool codecompletiontool codeatom codetree \ definetemplates expreval keywordfunclists linkscanner sourcechanger \ diff --git a/components/codetools/allcodetoolunits.pp b/components/codetools/allcodetoolunits.pp index 2a829bee72..b1d5efc5d5 100644 --- a/components/codetools/allcodetoolunits.pp +++ b/components/codetools/allcodetoolunits.pp @@ -19,7 +19,7 @@ uses StdCodeTools, MethodJumpTool, EventCodeTool, CodeCompletionTool, LinkScanner, FindDeclarationCache, BasicCodeTools, CodeTree, CodeAtom, SourceChanger, CodeToolMemManager, CodeCache, KeywordFuncLists, SourceLog, ExprEval, - DefineTemplates, FileProcs, AVL_Tree; + DefineTemplates, FileProcs, AVL_Tree, CodeToolsStrConsts; implementation @@ -29,6 +29,9 @@ end. { ============================================================================= $Log$ + Revision 1.9 2002/03/28 20:31:01 lazarus + MG: added inputhistory + Revision 1.8 2002/01/31 16:52:24 lazarus MG: added base class for mem managers and started node cache diff --git a/components/codetools/basiccodetools.pas b/components/codetools/basiccodetools.pas index 1e9cf212a6..32aa671922 100644 --- a/components/codetools/basiccodetools.pas +++ b/components/codetools/basiccodetools.pas @@ -33,7 +33,7 @@ unit BasicCodeTools; interface uses - Classes, SysUtils, SourceLog, KeywordFuncLists; + Classes, SysUtils, CodeToolsStrConsts, SourceLog, KeywordFuncLists; //----------------------------------------------------------------------------- // functions / procedures diff --git a/components/codetools/codecompletiontool.pas b/components/codetools/codecompletiontool.pas index 4e4aaf528e..58533852c0 100644 --- a/components/codetools/codecompletiontool.pas +++ b/components/codetools/codecompletiontool.pas @@ -49,9 +49,9 @@ uses {$IFDEF MEM_CHECK} MemCheck, {$ENDIF} - Classes, SysUtils, CodeTree, CodeAtom, PascalParserTool, MethodJumpTool, - SourceLog, KeywordFuncLists, BasicCodeTools, LinkScanner, CodeCache, AVL_Tree, - TypInfo, SourceChanger; + Classes, SysUtils, CodeToolsStrConsts, CodeTree, CodeAtom, PascalParserTool, + MethodJumpTool, SourceLog, KeywordFuncLists, BasicCodeTools, LinkScanner, + CodeCache, AVL_Tree, TypInfo, SourceChanger; type TNewClassPart = (ncpPrivateProcs, ncpPrivateVars, @@ -305,12 +305,12 @@ var Parts: array[TPropPart] of TAtomPosition; function ReadSimpleSpec(SpecWord, SpecParam: TPropPart): boolean; begin if Parts[SpecWord].StartPos>=1 then - RaiseException('property specifier already defined: '+GetAtom); + RaiseExceptionFmt(ctsPropertySpecifierAlreadyDefined,[GetAtom]); Parts[SpecWord]:=CurPos; ReadNextAtom; Result:=AtomIsWord; if not Result then - RaiseException('expected identifier but '+GetAtom+' found'); + RaiseExceptionFmt(ctsIdentExpectedButAtomFound,[GetAtom]); if WordIsPropertySpecifier.DoItUpperCase(UpperSrc,CurPos.StartPos, CurPos.EndPos-CurPos.StartPos) then exit; Parts[SpecParam]:=CurPos; @@ -342,7 +342,7 @@ writeln('[TCodeCompletionCodeTool.CompleteProperty] Checking Property ',GetAtom) {$IFDEF CTDEBUG} writeln('[TCodeCompletionCodeTool.CompleteProperty] error parsing param list'); {$ENDIF} - RaiseException('error in paramlist'); + RaiseException(ctsErrorInParamList); end; CleanParamList:=GetExtraction; Parts[ppParamList].EndPos:=CurPos.EndPos; @@ -361,19 +361,19 @@ writeln('[TCodeCompletionCodeTool.CompleteProperty] no type : found -> ignore pr or UpAtomIs('END') or AtomIsChar(';') or (not AtomIsIdentifier(false)) or AtomIsKeyWord then begin // no type name found -> ignore this property - RaiseException('property type expected, but '+GetAtom+' found'); + RaiseExceptionFmt(ctsPropertTypeExpectedButAtomFound,[GetAtom]); end; Parts[ppType]:=CurPos; // parse specifiers ReadNextAtom; if UpAtomIs('INDEX') then begin if Parts[ppIndexWord].StartPos>=1 then - RaiseException('index specifier redefined'); + RaiseException(ctsIndexSpecifierRedefined); Parts[ppIndexWord]:=CurPos; ReadNextAtom; if WordIsPropertySpecifier.DoItUpperCase(UpperSrc,CurPos.StartPos, CurPos.EndPos-CurPos.StartPos) then - RaiseException('index parameter expected, but '+GetAtom+' found'); + RaiseExceptionFmt(ctsIndexParameterExpectedButAtomFound,[GetAtom]); Parts[ppIndex].StartPos:=CurPos.StartPos; if not ReadConstant(true,false,[]) then exit; Parts[ppIndex].EndPos:=LastAtoms.GetValueAt(0).EndPos; @@ -388,12 +388,12 @@ writeln('[TCodeCompletionCodeTool.CompleteProperty] no type : found -> ignore pr exit; end else if UpAtomIs('DEFAULT') then begin if Parts[ppDefaultWord].StartPos>=1 then - RaiseException('default specifier redefined'); + RaiseException(ctsDefaultSpecifierRedefined); Parts[ppDefaultWord]:=CurPos; ReadNextAtom; if WordIsPropertySpecifier.DoItUpperCase(UpperSrc,CurPos.StartPos, CurPos.EndPos-CurPos.StartPos) then - RaiseException('default parameter expected, but '+GetAtom+' found'); + RaiseExceptionFmt(ctsDefaultParameterExpectedButAtomFound,[GetAtom]); Parts[ppDefault].StartPos:=CurPos.StartPos; if not ReadConstant(true,false,[]) then exit; Parts[ppDefault].EndPos:=LastAtoms.GetValueAt(0).EndPos; @@ -401,11 +401,11 @@ writeln('[TCodeCompletionCodeTool.CompleteProperty] no type : found -> ignore pr if not ReadSimpleSpec(ppImplementsWord,ppImplements) then exit; end else if UpAtomIs('NODEFAULT') then begin if Parts[ppNoDefaultWord].StartPos>=1 then - RaiseException('nodefault specifier defined twice'); + RaiseException(ctsNodefaultSpecifierDefinedTwice); Parts[ppNoDefaultWord]:=CurPos; ReadNextAtom; end else - RaiseException('; expected, but '+GetAtom+' found'); + RaiseExceptionFmt(ctsCharExpectedButAtomFound,[';',GetAtom]); end; if (CurPos.StartPos>PropNode.EndPos) then RaiseException('Reparsing error (Complete Property)'); diff --git a/components/codetools/codetree.pas b/components/codetools/codetree.pas index 122a9d5601..4f7939871c 100644 --- a/components/codetools/codetree.pas +++ b/components/codetools/codetree.pas @@ -40,7 +40,8 @@ uses {$IFDEF MEM_CHECK} MemCheck, {$ENDIF} - Classes, SysUtils, BasicCodeTools, AVL_Tree, CodeToolMemManager; + Classes, SysUtils, CodeToolsStrConsts, BasicCodeTools, AVL_Tree, + CodeToolMemManager; //----------------------------------------------------------------------------- diff --git a/components/codetools/customcodetool.pas b/components/codetools/customcodetool.pas index 41f44182a7..d49864e53b 100644 --- a/components/codetools/customcodetool.pas +++ b/components/codetools/customcodetool.pas @@ -39,8 +39,9 @@ uses {$IFDEF MEM_CHECK} MemCheck, {$ENDIF} - Classes, SysUtils, CodeTree, CodeAtom, SourceLog, KeywordFuncLists, - BasicCodeTools, LinkScanner, CodeCache, AVL_Tree, TypInfo, SourceChanger; + Classes, SysUtils, CodeToolsStrConsts, CodeTree, CodeAtom, SourceLog, + KeywordFuncLists, BasicCodeTools, LinkScanner, CodeCache, AVL_Tree, TypInfo, + SourceChanger; type TCustomCodeTool = class(TObject) @@ -56,6 +57,8 @@ type procedure BuildDefaultKeyWordFunctions; virtual; procedure SetScanner(NewScanner: TLinkScanner); virtual; procedure RaiseException(const AMessage: string); virtual; + procedure RaiseExceptionFmt(const AMessage: string; + const args : array of const); virtual; procedure DoDeleteNodes; virtual; public Tree: TCodeTree; @@ -230,6 +233,12 @@ begin raise ECodeToolError.Create(Self,AMessage); end; +procedure TCustomCodeTool.RaiseExceptionFmt(const AMessage: string; + const args: array of const); +begin + RaiseException(Format(AMessage,args)); +end; + procedure TCustomCodeTool.SetScanner(NewScanner: TLinkScanner); begin if NewScanner=FScanner then exit; @@ -248,23 +257,23 @@ end; function TCustomCodeTool.NodeSubDescToStr(Desc, SubDesc: integer): string; begin if SubDesc<>0 then - Result:='(unknown subdescriptor '+IntToStr(SubDesc)+')' + Result:=Format(ctsUnknownSubDescriptor,[IntToStr(SubDesc)]) else Result:=''; case Desc of ctnProcedure: begin - if (SubDesc and ctnsForwardDeclaration)>0 then Result:='Forward'; + if (SubDesc and ctnsForwardDeclaration)>0 then Result:=ctsForward; end; ctnProcedureHead, ctnBeginBlock: begin - if (SubDesc and ctnsNeedJITParsing)>0 then Result:='Unparsed'; + if (SubDesc and ctnsNeedJITParsing)>0 then Result:=ctsUnparsed; end; ctnClass: begin Result:=''; - if (SubDesc and ctnsForwardDeclaration)>0 then Result:='Forward'; - if (SubDesc and ctnsNeedJITParsing)>0 then Result:=Result+'Unparsed'; + if (SubDesc and ctnsForwardDeclaration)>0 then Result:=ctsForward; + if (SubDesc and ctnsNeedJITParsing)>0 then Result:=Result+ctsUnparsed; end; end; end; @@ -405,21 +414,19 @@ begin Result:=true else begin if ExceptionOnNotFound then - RaiseException( - 'identifier expected, but keyword '+GetAtom+' found') + RaiseExceptionFmt(ctsIdentExpectedButKeyWordFound,[GetAtom]) else Result:=false; end; end else begin if ExceptionOnNotFound then - RaiseException( - 'identifier expected, but '+GetAtom+' found') + RaiseExceptionFmt(ctsIdentExpectedButAtomFound,[GetAtom]) else Result:=false; end; end else begin if ExceptionOnNotFound then - RaiseException('unexpected end of file (identifier expected)') + RaiseException(ctsIdentExpectedButEOFFound) else Result:=false; end; @@ -1080,8 +1087,7 @@ begin AntiCloseBracket:=')'; end else begin if ExceptionOnNotFound then - RaiseException( - 'bracket open expected, but '+GetAtom+' found'); + RaiseExceptionFmt(ctsBracketOpenExpectedButAtomFound,[GetAtom]); exit; end; Start:=CurPos; @@ -1092,8 +1098,7 @@ begin or UpAtomIs('END') then begin CurPos:=Start; if ExceptionOnNotFound then - RaiseException( - 'bracket '+CloseBracket+' not found'); + RaiseExceptionFmt(ctsBracketNotFound,[CloseBracket]); exit; end; if (AtomIsChar('(')) or (AtomIsChar('[')) then begin @@ -1118,8 +1123,7 @@ begin AntiCloseBracket:='('; end else begin if ExceptionOnNotFound then - RaiseException( - 'bracket close expected, but '+GetAtom+' found'); + RaiseExceptionFmt(ctsBracketCloseExpectedButAtomFound,[GetAtom]); exit; end; Start:=CurPos; @@ -1130,8 +1134,7 @@ begin or UpAtomIs('END') or UpAtomIs('BEGIN') then begin CurPos:=Start; if ExceptionOnNotFound then - RaiseException( - 'bracket '+CloseBracket+' not found'); + RaiseExceptionFmt(ctsBracketNotFound,[CloseBracket]); exit; end; if (AtomIsChar(')')) or (AtomIsChar(']')) then begin @@ -1315,7 +1318,7 @@ begin Result:=nil; if (Result=nil) and ExceptionOnNotFound then begin MoveCursorToCleanPos(P); - RaiseException('no node found at cursor'); + RaiseException(ctsNoNodeFoundAtCursor); end; end; @@ -1501,7 +1504,7 @@ begin if (Scanner<>nil) and (Scanner.MainCode<>nil) then Result:=TCodeBuffer(Scanner.MainCode).Filename else - Result:='(unknown mainfilename)'; + Result:=ctsUnknownMainFilename; end; { ECodeToolError } diff --git a/ide/inputhistory.pas b/ide/inputhistory.pas new file mode 100644 index 0000000000..eeec5e4f01 --- /dev/null +++ b/ide/inputhistory.pas @@ -0,0 +1,172 @@ +{ +/*************************************************************************** + inputhistory.pas + ---------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +} +unit InputHistory; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, IDEProcs, XMLCfg, LazConf; + +type + TInputHistories = class + private + FFilename: string; + + // Find- and replace-history + FFindHistory: TStringList; + FReplaceHistory: TStringList; + FMaxFindHistory: Integer; + procedure SetFilename(const AValue: string); + public + constructor Create; + destructor Destroy; override; + procedure Clear; + procedure Load; + procedure Save; + procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string); + procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); + procedure SetLazarusDefaultFilename; + + // Find- and replace-history + procedure AddToFindHistory(const AFindStr: string); + procedure AddToReplaceHistory(const AReplaceStr: String); + + public + // Find- and replace-history + property FindHistory: TStringList read FFindHistory write FFindHistory; + property ReplaceHistory: TStringList read FReplaceHistory write FReplaceHistory; + property MaxFindHistory: Integer read FMaxFindHistory write FMaxFindHistory; + property Filename: string read FFilename write SetFilename; + end; + +var InputHistories: TInputHistories; + + +implementation + + +const + DefaultHistoryFile = 'inputhistory.xml'; + InputHistoryVersion = 1; + +{ TInputHistories } + +procedure TInputHistories.SetFilename(const AValue: string); +begin + FFilename:=AValue; +end; + +constructor TInputHistories.Create; +begin + inherited Create; + // Find- and replace-history + FFindHistory:=TStringList.Create; + FReplaceHistory:=TStringList.Create; + FMaxFindHistory:=20; + + FFilename:=''; + Clear; +end; + +destructor TInputHistories.Destroy; +begin + FFindHistory.Free; + FReplaceHistory.Free; + inherited Destroy; +end; + +procedure TInputHistories.Clear; +begin + FFindHistory.Clear; + FReplaceHistory.Clear; +end; + +procedure TInputHistories.LoadFromXMLConfig(XMLConfig: TXMLConfig; + const Path: string); +begin + // Find- and replace-history + fMaxFindHistory:=XMLConfig.GetValue(Path+'Find/History/Max',FMaxFindHistory); + LoadRecentList(XMLConfig,FFindHistory,Path+'Find/History/Find/'); + LoadRecentList(XMLConfig,FReplaceHistory,Path+'Find/History/Replace/'); +end; + +procedure TInputHistories.SaveToXMLConfig(XMLConfig: TXMLConfig; + const Path: string); +begin + // Find- and replace-history + XMLConfig.SetValue(Path+'Find/History/Max',FMaxFindHistory); + SaveRecentList(XMLConfig,FFindHistory,Path+'Find/History/Find/'); + SaveRecentList(XMLConfig,FReplaceHistory,Path+'Find/History/Replace/'); +end; + +procedure TInputHistories.SetLazarusDefaultFilename; +var + ConfFileName: string; +begin + ConfFileName:=SetDirSeparators( + GetPrimaryConfigPath+'/'+DefaultHistoryFile); + CopySecondaryConfigFile(DefaultHistoryFile); + FFilename:=ConfFilename; +end; + +procedure TInputHistories.Load; +var + XMLConfig: TXMLConfig; + //FileVersion: integer; +begin + try + XMLConfig:=TXMLConfig.Create(FFileName); + //FileVersion:=XMLConfig.GetValue('InputHistory/Version/Value',0); + LoadFromXMLConfig(XMLConfig,'InputHistory/'); + XMLConfig.Free; + except + // ToDo + writeln('[TCodeToolsOptions.Load] error reading "',FFilename,'"'); + end; +end; + +procedure TInputHistories.Save; +var + XMLConfig: TXMLConfig; +begin + try + XMLConfig:=TXMLConfig.Create(FFileName); + XMLConfig.SetValue('InputHistory/Version/Value', + InputHistoryVersion); + SaveToXMLConfig(XMLConfig,'InputHistory/'); + XMLConfig.Flush; + XMLConfig.Free; + except + // ToDo + writeln('[TEnvironmentOptions.Save] error writing "',FFilename,'"'); + end; +end; + +procedure TInputHistories.AddToFindHistory(const AFindStr: string); +begin + AddToRecentList(AFindStr,FFindHistory,FMaxFindHistory); +end; + +procedure TInputHistories.AddToReplaceHistory(const AReplaceStr: String); +begin + AddToRecentList(AReplaceStr,FReplaceHistory,FMaxFindHistory); +end; + +end. +