extended quick fix items for jumping, started jumping to linker errors

git-svn-id: trunk@9456 -
This commit is contained in:
mattias 2006-06-20 10:22:35 +00:00
parent 797928f45b
commit 9e55b163b0
9 changed files with 390 additions and 52 deletions

View File

@ -445,8 +445,10 @@ type
var FoundInUnits, MissingInUnits, NormalUnits: TStrings): boolean;
function CommentUnitsInUsesSections(Code: TCodeBuffer;
MissingUnits: TStrings): boolean;
function FindUnit(Code: TCodeBuffer;
var AnUnitName, AnUnitInFilename: string): string;
function FindUnitCaseInsensitive(Code: TCodeBuffer;
var AnUnitName, AnUnitInFilename: string): string;
function FindUnitSource(Code: TCodeBuffer;
const AnUnitName, AnUnitInFilename: string): TCodeBuffer;
// resources
property OnFindDefinePropertyForContext: TOnFindDefinePropertyForContext
@ -541,7 +543,7 @@ type
Proc: TGetStringProc): boolean;
function PublishedMethodExists(Code:TCodeBuffer; const AClassName,
AMethodName: string; TypeData: PTypeData;
var MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean
out MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean
): boolean;
function JumpToPublishedMethodBody(Code: TCodeBuffer;
const AClassName, AMethodName: string;
@ -558,6 +560,12 @@ type
DirectiveList: TStrings): boolean;
function SetIDEDirectives(Code: TCodeBuffer;
DirectiveList: TStrings): boolean;
// linker jumping
function JumpToLinkerIdentifier(Code: TCodeBuffer;
const MangledFunction, Identifier: string;
out NewCode: TCodeBuffer;
out NewX, NewY, NewTopLine: integer): boolean;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2443,7 +2451,7 @@ end;
function TCodeToolManager.PublishedMethodExists(Code:TCodeBuffer;
const AClassName, AMethodName: string; TypeData: PTypeData;
var MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean): boolean;
out MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean): boolean;
begin
{$IFDEF CTDEBUG}
DebugLn('TCodeToolManager.PublishedMethodExists A ',Code.Filename,' ',AClassName,':',AMethodName);
@ -2547,6 +2555,30 @@ begin
end;
end;
function TCodeToolManager.JumpToLinkerIdentifier(Code: TCodeBuffer;
const MangledFunction, Identifier: string; out NewCode: TCodeBuffer; out
NewX, NewY, NewTopLine: integer): boolean;
var
NewPos: TCodeXYPosition;
begin
{$IFDEF CTDEBUG}
DebugLn('TCodeToolManager.JumpToLinkerIdentifier A ',Code.Filename);
{$ENDIF}
Result:=false;
if not InitCurCodeTool(Code) then exit;
try
Result:=FCurCodeTool.FindJumpPointForLinkerPos(MangledFunction, Identifier,
NewPos,NewTopLine);
if Result then begin
NewX:=NewPos.X;
NewY:=NewPos.Y;
NewCode:=NewPos.Code;
end;
except
on e: Exception do Result:=HandleException(e);
end;
end;
function TCodeToolManager.CompleteCode(Code: TCodeBuffer; X,Y,TopLine: integer;
var NewCode: TCodeBuffer; var NewX, NewY, NewTopLine: integer): boolean;
var
@ -2962,16 +2994,31 @@ begin
end;
end;
function TCodeToolManager.FindUnit(Code: TCodeBuffer; var AnUnitName,
AnUnitInFilename: string): string;
function TCodeToolManager.FindUnitCaseInsensitive(Code: TCodeBuffer;
var AnUnitName, AnUnitInFilename: string): string;
begin
Result:='';
{$IFDEF CTDEBUG}
DebugLn('TCodeToolManager.FindUnitCaseInsensitive A ',Code.Filename,' TheUnitName="',TheUnitName,'"');
{$ENDIF}
if not InitCurCodeTool(Code) then exit;
try
Result:=FCurCodeTool.FindUnitCaseInsensitive(AnUnitName,AnUnitInFilename);
except
on e: Exception do HandleException(e);
end;
end;
function TCodeToolManager.FindUnitSource(Code: TCodeBuffer; const AnUnitName,
AnUnitInFilename: string): TCodeBuffer;
begin
Result:=nil;
{$IFDEF CTDEBUG}
DebugLn('TCodeToolManager.FindUnit A ',Code.Filename,' TheUnitName="',TheUnitName,'"');
{$ENDIF}
if not InitCurCodeTool(Code) then exit;
try
Result:=FCurCodeTool.FindUnitCaseInsensitive(AnUnitName,AnUnitInFilename);
Result:=FCurCodeTool.FindUnitSource(AnUnitName,AnUnitInFilename,false);
except
on e: Exception do HandleException(e);
end;

View File

@ -70,11 +70,11 @@ type
TypeData: PTypeData; Proc: TGetStringProc): boolean;
function PublishedMethodExists(const UpperClassName,
UpperMethodName: string; TypeData: PTypeData;
var MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean
out MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean
): boolean;
function PublishedMethodExists(ClassNode: TCodeTreeNode;
const UpperMethodName: string; TypeData: PTypeData;
var MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean
out MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean
): boolean;
function JumpToPublishedMethodBody(const UpperClassName,
UpperMethodName: string;
@ -372,7 +372,7 @@ end;
function TEventsCodeTool.PublishedMethodExists(const UpperClassName,
UpperMethodName: string; TypeData: PTypeData;
var MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean): boolean;
out MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean): boolean;
var ClassNode: TCodeTreeNode;
begin
ActivateGlobalWriteLock;
@ -395,7 +395,7 @@ end;
function TEventsCodeTool.PublishedMethodExists(ClassNode: TCodeTreeNode;
const UpperMethodName: string; TypeData: PTypeData;
var MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean): boolean;
out MethodIsCompatible, MethodIsPublished, IdentIsMethod: boolean): boolean;
var
FoundContext: TFindContext;
CompListSize: integer;

View File

@ -42,10 +42,13 @@ uses
{$ENDIF}
Classes, SysUtils, FileProcs, CodeTree, CodeAtom, PascalParserTool,
StdCodeTools, CodeTemplatesTool, KeywordFuncLists, BasicCodeTools,
LinkScanner, AVL_Tree;
LinkScanner, CodeCache, AVL_Tree;
type
{ TMethodJumpingCodeTool }
TMethodJumpingCodeTool = class(TCodeTemplatesTool)
protected
procedure RemoveCorrespondingProcNodes(Tree1, Tree2: TAVLTree;
@ -74,6 +77,11 @@ type
Attr: TProcHeadAttributes): TStringList;
function FindSubProcPath(SubProcPath: TStrings; Attr: TProcHeadAttributes;
SkipInterface: boolean): TCodeTreeNode;
function FindJumpPointForLinkerPos(const MangledFunction,
Identifier: string; out NewPos: TCodeXYPosition;
out NewTopLine: integer): boolean;
procedure WriteCodeTreeNodeExtTree(ExtTree: TAVLTree);
end;
@ -940,6 +948,30 @@ begin
Result:=SearchSubProcPath(StartNode,0);
end;
function TMethodJumpingCodeTool.FindJumpPointForLinkerPos(
const MangledFunction, Identifier: string;
out NewPos: TCodeXYPosition; out NewTopLine: integer): boolean;
{ Examples:
GTK2_GTK_TYPE_CELL_RENDERER_COMBO$$LONGWORD
GTK2 is the unit.
GTK_TYPE_CELL_RENDERER_COMBO is the function or procedure name.
LONGWORD is the list of parameter types.
ADDFILETOAPACKAGEDLG_TADDFILETOAPACKAGEDIALOG_$__ADDFILETOAPACKAGEDLGCLOSE$TOBJECT$TCLOSEACTION
ADDFILETOAPACKAGEDLG is the unit.
TADDFILETOAPACKAGEDIALOG is the class.
ADDFILETOAPACKAGEDLGCLOSE is the method name.
$TOBJECT$TCLOSEACTION is the list of parameter types
}
begin
Result:=false;
BuildTree(false);
DebugLn(['TMethodJumpingCodeTool.FindJumpPointForLinkerPos ']);
end;
procedure TMethodJumpingCodeTool.WriteCodeTreeNodeExtTree(ExtTree: TAVLTree);
var
AVLNode: TAVLTreeNode;

View File

@ -1,8 +1,8 @@
#
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/05/31]
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/06/19]
#
default: all
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince arm-gba powerpc64-linux
BSDs = freebsd netbsd openbsd darwin
UNIXs = linux $(BSDs) solaris qnx
LIMIT83fs = go32v2 os2 emx watcom
@ -230,7 +230,7 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
endif
PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
override PACKAGE_NAME=printer4lazarus
override PACKAGE_VERSION=0.5
override PACKAGE_VERSION=0.0.0.2
ifndef LCL_PLATFORM
ifeq ($(OS_TARGET),win32)
LCL_PLATFORM=win32
@ -275,6 +275,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
override TARGET_UNITS+=printer4lazarus.pas
endif
ifeq ($(FULL_TARGET),i386-darwin)
override TARGET_UNITS+=printer4lazarus.pas
endif
ifeq ($(FULL_TARGET),i386-emx)
override TARGET_UNITS+=printer4lazarus.pas
endif
@ -344,9 +347,15 @@ endif
ifeq ($(FULL_TARGET),arm-linux)
override TARGET_UNITS+=printer4lazarus.pas
endif
ifeq ($(FULL_TARGET),arm-palmos)
override TARGET_UNITS+=printer4lazarus.pas
endif
ifeq ($(FULL_TARGET),arm-wince)
override TARGET_UNITS+=printer4lazarus.pas
endif
ifeq ($(FULL_TARGET),arm-gba)
override TARGET_UNITS+=printer4lazarus.pas
endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override TARGET_UNITS+=printer4lazarus.pas
endif
@ -386,6 +395,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
ifeq ($(FULL_TARGET),i386-darwin)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
ifeq ($(FULL_TARGET),i386-emx)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
@ -455,9 +467,15 @@ endif
ifeq ($(FULL_TARGET),arm-linux)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
ifeq ($(FULL_TARGET),arm-palmos)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
ifeq ($(FULL_TARGET),arm-wince)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
ifeq ($(FULL_TARGET),arm-gba)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
@ -497,6 +515,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-darwin)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-emx)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
@ -566,9 +587,15 @@ endif
ifeq ($(FULL_TARGET),arm-linux)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-palmos)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-wince)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-gba)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
@ -608,6 +635,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
override COMPILER_UNITDIR+=unix/ win32/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
endif
ifeq ($(FULL_TARGET),i386-darwin)
override COMPILER_UNITDIR+=unix/ win32/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
endif
ifeq ($(FULL_TARGET),i386-emx)
override COMPILER_UNITDIR+=unix/ win32/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
endif
@ -677,9 +707,15 @@ endif
ifeq ($(FULL_TARGET),arm-linux)
override COMPILER_UNITDIR+=unix/ win32/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
endif
ifeq ($(FULL_TARGET),arm-palmos)
override COMPILER_UNITDIR+=unix/ win32/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
endif
ifeq ($(FULL_TARGET),arm-wince)
override COMPILER_UNITDIR+=unix/ win32/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
endif
ifeq ($(FULL_TARGET),arm-gba)
override COMPILER_UNITDIR+=unix/ win32/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override COMPILER_UNITDIR+=unix/ win32/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
endif
@ -719,6 +755,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
ifeq ($(FULL_TARGET),i386-darwin)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
ifeq ($(FULL_TARGET),i386-emx)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
@ -788,9 +827,15 @@ endif
ifeq ($(FULL_TARGET),arm-linux)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
ifeq ($(FULL_TARGET),arm-palmos)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
ifeq ($(FULL_TARGET),arm-wince)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
ifeq ($(FULL_TARGET),arm-gba)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
@ -977,6 +1022,9 @@ endif
ifndef INSTALL_DATADIR
INSTALL_DATADIR=$(INSTALL_BASEDIR)
endif
ifndef INSTALL_SHAREDDIR
INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
endif
ifdef CROSSCOMPILE
ifndef CROSSBINDIR
CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
@ -997,7 +1045,9 @@ ASMEXT=.s
SMARTEXT=.sl
STATICLIBEXT=.a
SHAREDLIBEXT=.so
SHAREDLIBPREFIX=libfp
STATICLIBPREFIX=libp
IMPORTLIBPREFIX=libimp
RSTEXT=.rst
ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
ifeq ($(OS_TARGET),go32v1)
@ -1110,6 +1160,11 @@ EXEEXT=
HASSHAREDLIB=1
SHORTSUFFIX=dwn
endif
ifeq ($(OS_TARGET),gba)
EXEEXT=.gba
SHAREDLIBEXT=.so
SHORTSUFFIX=gba
endif
else
ifeq ($(OS_TARGET),go32v1)
PPUEXT=.pp1
@ -1430,12 +1485,17 @@ endif
endif
export ZIPPROG
ifndef TARPROG
TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
ifeq ($(TARPROG),)
TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
ifeq ($(TARPROG),)
TARPROG= __missing_command_TARPROG
else
TARPROG:=$(firstword $(TARPROG))
endif
else
TARPROG:=$(firstword $(TARPROG))
endif
endif
export TARPROG
ASNAME=$(BINUTILSPREFIX)as
@ -1559,6 +1619,9 @@ endif
ifeq ($(FULL_TARGET),i386-wdosx)
REQUIRE_PACKAGES_RTL=1
endif
ifeq ($(FULL_TARGET),i386-darwin)
REQUIRE_PACKAGES_RTL=1
endif
ifeq ($(FULL_TARGET),i386-emx)
REQUIRE_PACKAGES_RTL=1
endif
@ -1628,9 +1691,15 @@ endif
ifeq ($(FULL_TARGET),arm-linux)
REQUIRE_PACKAGES_RTL=1
endif
ifeq ($(FULL_TARGET),arm-palmos)
REQUIRE_PACKAGES_RTL=1
endif
ifeq ($(FULL_TARGET),arm-wince)
REQUIRE_PACKAGES_RTL=1
endif
ifeq ($(FULL_TARGET),arm-gba)
REQUIRE_PACKAGES_RTL=1
endif
ifeq ($(FULL_TARGET),powerpc64-linux)
REQUIRE_PACKAGES_RTL=1
endif
@ -1666,6 +1735,9 @@ endif
ifneq ($(OS_TARGET),$(OS_SOURCE))
override FPCOPT+=-T$(OS_TARGET)
endif
ifneq ($(CPU_TARGET),$(CPU_SOURCE))
override FPCOPT+=-P$(CPU_TARGET)
endif
ifeq ($(OS_SOURCE),openbsd)
override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
endif
@ -1700,14 +1772,15 @@ override FPCOPT+=-gl
override FPCOPTDEF+=DEBUG
endif
ifdef RELEASE
ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
ifeq ($(CPU_TARGET),i386)
FPCCPUOPT:=-OG2p3
else
endif
ifeq ($(CPU_TARGET),powerpc)
FPCCPUOPT:=-O1r
else
FPCCPUOPT:=
endif
else
FPCCPUOPT:=-O2
endif
override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
override FPCOPTDEF+=RELEASE
@ -1716,9 +1789,7 @@ ifdef STRIP
override FPCOPT+=-Xs
endif
ifdef OPTIMIZE
ifeq ($(CPU_TARGET),i386)
override FPCOPT+=-OG2p3
endif
override FPCOPT+=-O2
endif
ifdef VERBOSE
override FPCOPT+=-vwni
@ -1762,11 +1833,14 @@ override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
endif
endif
ifeq ($(OS_TARGET),linux)
ifeq ($(FPC_VERSION),1.0.6)
override FPCOPTDEF+=HASUNIX
ifdef CREATESHARED
override FPCOPT+=-Cg
ifeq ($(CPU_TARGET),i386)
override FPCOPT+=-Aas
endif
endif
ifdef LINKSHARED
endif
ifdef OPT
override FPCOPT+=$(OPT)
endif
@ -1781,6 +1855,14 @@ override FPCEXTCMD:=$(FPCOPT)
override FPCOPT:=!FPCEXTCMD
export FPCEXTCMD
endif
override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
override ACROSSCOMPILE=1
endif
ifdef ACROSSCOMPILE
override FPCOPT+=$(CROSSOPT)
endif
override COMPILER:=$(FPC) $(FPCOPT)
ifeq (,$(findstring -s ,$(COMPILER)))
EXECPPAS=
@ -1802,7 +1884,7 @@ ifdef TARGET_RSTS
override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
override CLEANRSTFILES+=$(RSTFILES)
endif
.PHONY: fpc_all fpc_smart fpc_debug fpc_release
.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
@$(ECHOREDIR) Compiled > $(FPCMADE)
fpc_all: $(FPCMADE)
@ -1843,6 +1925,38 @@ vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
.PHONY: fpc_shared
override INSTALLTARGET+=fpc_shared_install
ifndef SHARED_LIBVERSION
SHARED_LIBVERSION=$(FPC_VERSION)
endif
ifndef SHARED_LIBNAME
SHARED_LIBNAME=$(PACKAGE_NAME)
endif
ifndef SHARED_FULLNAME
SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
endif
ifndef SHARED_LIBUNITS
SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
endif
fpc_shared:
ifdef HASSHAREDLIB
$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
ifneq ($(SHARED_BUILD),n)
$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
endif
else
@$(ECHO) Shared Libraries not supported
endif
fpc_shared_install:
ifneq ($(SHARED_BUILD),n)
ifneq ($(SHARED_LIBUNITS),)
ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
endif
endif
endif
.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
ifdef INSTALL_UNITS
override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
@ -1851,7 +1965,7 @@ 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 INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
ifneq ($(UNITTARGETDIRPREFIX),)
override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
@ -2003,7 +2117,7 @@ ifdef CLEAN_UNITS
override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
endif
ifdef CLEANPPUFILES
override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
ifdef DEBUGSYMEXT
override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
endif
@ -2173,7 +2287,7 @@ smart: fpc_smart
release: fpc_release
units: fpc_units
examples:
shared:
shared: fpc_shared
install: fpc_install
sourceinstall: fpc_sourceinstall
exampleinstall: fpc_exampleinstall

View File

@ -1,8 +1,8 @@
# Makefile.fpc for Printer4Lazarus 0.5
# Makefile.fpc for Printer4Lazarus 0.0.0.2
[package]
name=printer4lazarus
version=0.5
version=0.0.0.2
[compiler]
unittargetdir=lib/$(CPU_TARGET)-$(OS_TARGET)

View File

@ -9337,7 +9337,6 @@ var MaxMessages: integer;
NewFilename: String;
begin
Result:=false;
//DebugLn('TMainIDE.DoJumpToCompilerMessage Index=',dbgs(Index));
MaxMessages:=MessagesView.VisibleItemCount;
if Index>=MaxMessages then exit;
if (Index<0) then begin
@ -9353,8 +9352,13 @@ begin
inc(Index);
end;
if Index>=MaxMessages then exit;
MessagesView.SelectedMessageIndex:=Index;
end;
MessagesView.SelectedMessageIndex:=Index;
// first try the plugins
if MessagesView.ExecuteMsgLinePlugin(imqfoJump) then exit;
// default: jump to source position
MessagesView.GetVisibleMessageAt(Index,CurMsg,CurDir);
if TheOutputFilter.GetSourcePosition(CurMsg,Filename,LogCaretXY,MsgType)
then begin

View File

@ -30,8 +30,8 @@ unit MsgQuickFixes;
interface
uses
Classes, SysUtils, LCLProc, IDEMsgIntf, TextTools, LazarusIDEStrConsts,
LazIDEIntf, CodeCache, CodeToolManager;
Classes, SysUtils, Dialogs, FileUtil, LCLProc, IDEMsgIntf, TextTools,
LazarusIDEStrConsts, ProjectIntf, LazIDEIntf, CodeCache, CodeToolManager;
type
@ -43,6 +43,14 @@ type
function IsApplicable(Line: TIDEMessageLine): boolean; override;
procedure Execute(const Msg: TIDEMessageLine; Step: TIMQuickFixStep); override;
end;
{ TQuickFixLinkerUndefinedReference }
TQuickFixLinkerUndefinedReference = class(TIDEMsgQuickFixItem)
public
constructor Create;
procedure Execute(const Msg: TIDEMessageLine; Step: TIMQuickFixStep); override;
end;
procedure QuickFixParameterNotUsed(Sender: TObject; Step: TIMQuickFixStep;
Msg: TIDEMessageLine);
@ -121,6 +129,7 @@ begin
'Unit "[a-z_0-9]+" not used in [a-z_0-9]+',[imqfoMenuItem],
nil,@QuickFixUnitNotUsed);
RegisterIDEMsgQuickFix(TQuickFixUnitNotFoundPosition.Create);
RegisterIDEMsgQuickFix(TQuickFixLinkerUndefinedReference.Create);
end;
procedure FreeStandardIDEQuickFixItems;
@ -175,5 +184,94 @@ begin
end;
end;
{ TQuickFixLinkerUndefinedReference }
constructor TQuickFixLinkerUndefinedReference.Create;
begin
Name:='Linker: undefined reference to';
Steps:=[imqfoJump];
RegExpression:='^(: .* `(.*)'')|((.*)\(\.text.*?\): .* `([A-Z0-9_$]+)'':)$';
end;
procedure TQuickFixLinkerUndefinedReference.Execute(const Msg: TIDEMessageLine;
Step: TIMQuickFixStep);
{ Example:
/usr/lib/fpc/2.1.1/units/i386-linux/gtk2/gtk2.o(.text+0xbba1): In function `GTK2_GTK_TYPE_CELL_RENDERER_COMBO$$LONGWORD':
undefined reference to `gtk_cell_renderer_combo_get_type'
}
procedure Error(const Msg: string);
begin
DebugLn('TQuickFixLinkerUndefinedReference.Execute ',Msg);
MessageDlg('TQuickFixLinkerUndefinedReference.Execute',
Msg,mtError,[mbCancel],0);
end;
procedure JumpTo(Line1, Line2: TIDEMessageLine);
var
Identifier: String;
Filename: String;
MangledFunction: String;
CurProject: TLazProject;
CodeBuf: TCodeBuffer;
NewCode: TCodeBuffer;
NewX, NewY, NewTopLine: integer;
AnUnitName: String;
begin
DebugLn(['JumpTo START ',Line1.Msg]);
if not REMatches(Line1.Msg,'^(.*)\(\.text.*?\): .* `([A-Z0-9_$]+)'':$')
then
exit;
Filename:=REVar(1);
MangledFunction:=REVar(2);
if not REMatches(Line2.Msg,'^: .* `(.*)''$') then exit;
Identifier:=REVar(1);
DebugLn(['TQuickFixLinkerUndefinedReference.JumpTo Filename="',Filename,'" MangledFunction="',MangledFunction,'" Identifier="',Identifier,'"']);
CurProject:=LazarusIDE.ActiveProject;
if CurProject=nil then begin
Error('no project');
exit;
end;
if (CurProject.MainFile=nil) then begin
Error('no main file in project');
exit;
end;
if (CurProject.MainFile=nil) then begin
Error('no main file in project');
exit;
end;
CodeBuf:=CodeToolBoss.FindFile(CurProject.MainFile.Filename);
if (CodeBuf=nil) then begin
Error('project main file has no source');
exit;
end;
AnUnitName:=ExtractFilenameOnly(Filename);
CodeBuf:=CodeToolBoss.FindUnitSource(CodeBuf,AnUnitName,'');
if (CodeBuf=nil) then begin
Error('unit not found: '+AnUnitName);
exit;
end;
if not CodeToolBoss.JumpToLinkerIdentifier(CodeBuf,
MangledFunction,Identifier,NewCode,NewX,NewY,NewTopLine)
then begin
Error('function not found: '+MangledFunction+' Identifier='+Identifier);
exit;
end;
LazarusIDE.DoOpenFileAndJumpToPos(NewCode.Filename,Point(NewX,NewY),
NewTopLine,-1,[]);
end;
begin
inherited Execute(Msg, Step);
if Step=imqfoJump then begin
DebugLn(['TQuickFixLinkerUndefinedReference.Execute ',Msg.Msg,' ',REMatches(Msg.Msg,'^(.*)\(\.text.*?\): .* `([A-Z0-9_$]+)'':$')]);
if (Msg.Position>0) and REMatches(Msg.Msg,'^: .* `(.*)''$') then
JumpTo(IDEMessagesWindow[Msg.Position-1],Msg)
else if (Msg.Position<IDEMessagesWindow.LinesCount-1)
and REMatches(Msg.Msg,'^(.*)\(\.text.*?\): .* `([A-Z0-9_$]+)'':$') then
JumpTo(Msg,IDEMessagesWindow[Msg.Position+1]);
end;
end;
end.

View File

@ -120,6 +120,7 @@ type
function FindNextItem(const Filename: string;
FirstLine, LineCount: integer): TAVLTreeNode;
procedure UpdateMsgSrcPos(Line: TLazMessageLine);
function GetLines(Index: integer): TIDEMessageLine; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
@ -137,7 +138,7 @@ type
procedure BeginBlock;
procedure EndBlock;
procedure ClearItems;
function ItemCount: integer;
function LinesCount: integer; override;
function VisibleItemCount: integer;
function MsgCount: integer;
procedure FilterLines(Filter: TOnFilterLine);
@ -145,18 +146,19 @@ type
procedure SrcEditLinesInsertedDeleted(const Filename: string;
FirstLine, LineCount: Integer);
procedure UpdateMsgLineInListBox(Line: TLazMessageLine);
function ExecuteMsgLinePlugin(Step: TIMQuickFixStep): boolean;
procedure ConsistencyCheck;
public
property LastLineIsProgress: boolean Read FLastLineIsProgress
Write SetLastLineIsProgress;
property Message: string Read GetMessage;
property Directory: string Read GetDirectory;
property SelectedMessageIndex: integer Read GetSelectedLineIndex // visible index
Write SetSelectedLineIndex;
property LastLineIsProgress: boolean read FLastLineIsProgress
write SetLastLineIsProgress;
property Message: string read GetMessage;
property Directory: string read GetDirectory;
property SelectedMessageIndex: integer read GetSelectedLineIndex // visible index
write SetSelectedLineIndex;
property OnSelectionChanged: TNotifyEvent
Read FOnSelectionChanged Write FOnSelectionChanged;
property Items[Index: integer]: TLazMessageLine Read GetItems;
property VisibleItems[Index: integer]: TLazMessageLine Read GetVisibleItems;
read FOnSelectionChanged write FOnSelectionChanged;
property Items[Index: integer]: TLazMessageLine read GetItems;
property VisibleItems[Index: integer]: TLazMessageLine read GetVisibleItems;
end;
var
@ -372,8 +374,8 @@ begin
//ConsistencyCheck;
//DebugLn('TMessagesView.Add START ItemCount=',dbgs(ItemCount),' VisibleCount=',dbgs(VisibleItemCount),' ListBoxCount=',dbgs(MessageListBox.Items.Count),' ProgressLine=',dbgs(ProgressLine),' VisibleLine=',dbgs(VisibleLine),' OriginalIndex=',dbgs(OriginalIndex),' Msg="',Msg,'"');
NewMsg:=nil;
if ItemCount>0 then begin
LastItem:=Items[ItemCount-1];
if LinesCount>0 then begin
LastItem:=Items[LinesCount-1];
if (OriginalIndex>=0) and (LastItem.OriginalIndex=OriginalIndex) then begin
// already added
NewMsg:=LastItem;
@ -475,7 +477,7 @@ begin
if (SrcLines=nil) or (SrcLines.Count=0) then exit;
StartOriginalIndex:=SrcLines[0].OriginalIndex;
DestStartIndex:=ItemCount-1;
DestStartIndex:=LinesCount-1;
while (DestStartIndex>=0)
and (Items[DestStartIndex].OriginalIndex<>StartOriginalIndex) do
dec(DestStartIndex);
@ -510,7 +512,7 @@ begin
SrcLine:=SrcLines[i];
DebugLn('TMessagesView.CollectLineParts i=',dbgs(i),' SrcLine=',MsgAsString(SrcLine));
end;
for i:=0 to ItemCount-1 do begin
for i:=0 to LinesCount-1 do begin
DestLine:=Items[i];
DebugLn('TMessagesView.CollectLineParts i=',dbgs(i),' DestLine=',MsgAsString(DestLine));
end;}
@ -527,7 +529,7 @@ begin
if LastSeparator >= 0 then
begin
while (VisibleItemCount > LastSeparator) do
DeleteLine(ItemCount - 1);
DeleteLine(LinesCount - 1);
FLastLineIsProgress := False;
end;
EndBlock;
@ -634,6 +636,34 @@ begin
end;
end;
function TMessagesView.ExecuteMsgLinePlugin(Step: TIMQuickFixStep): boolean;
var
i: Integer;
QuickFixItem: TIDEMsgQuickFixItem;
Msg: TLazMessageLine;
begin
Result:=false;
Msg:=GetMessageLine;
if Msg=nil then exit;
for i:=0 to IDEMsgQuickFixes.Count-1 do begin
QuickFixItem:=IDEMsgQuickFixes[i];
//DebugLn(['TMessagesView.ExecuteMsgLinePlugin ',Msg.Msg,' ',QuickFixItem.Name]);
if (Step in QuickFixItem.Steps)
and QuickFixItem.IsApplicable(Msg) then begin
Result:=true;
QuickFixItem.Execute(Msg,Step);
if Msg.Msg='' then begin
// message fixed -> delete
DeleteLine(Msg.Position);
end else begin
UpdateMsgSrcPos(Msg);
UpdateMsgLineInListBox(Msg);
end;
exit;
end;
end;
end;
{------------------------------------------------------------------------------
TMessagesView.Clear
------------------------------------------------------------------------------}
@ -693,7 +723,7 @@ begin
FLastLineIsProgress:=false;
end;
function TMessagesView.ItemCount: integer;
function TMessagesView.LinesCount: integer;
begin
Result := FItems.Count;
end;
@ -896,6 +926,7 @@ begin
UpdateMsgSrcPos(Msg);
UpdateMsgLineInListBox(Msg);
end;
exit;
//ConsistencyCheck;
end;
end;
@ -970,6 +1001,11 @@ begin
Line.Node:=FSrcPositions.Add(Line);
end;
function TMessagesView.GetLines(Index: integer): TIDEMessageLine;
begin
Result:=Items[Index];
end;
procedure TMessagesView.ConsistencyCheck;
var
i: Integer;

View File

@ -113,8 +113,9 @@ type
{ TIDEMsgQuickFixItem }
TIMQuickFixStep = (
imqfoMenuItem, // add menu item in popup menu for this item
imqfoImproveMessage // rewrites message
imqfoMenuItem, // add menu item in popup menu for this item
imqfoImproveMessage, // rewrites message
imqfoJump // user clicks on message
);
TIMQuickFixSteps = set of TIMQuickFixStep;
@ -172,10 +173,16 @@ type
property Items[Index: integer]: TIDEMsgQuickFixItem read GetItems; default;
end;
{ TIDEMessagesWindowInterface }
TIDEMessagesWindowInterface = class(TForm)
protected
function GetLines(Index: integer): TIDEMessageLine; virtual; abstract;
public
procedure Clear; virtual; abstract;
procedure AddMsg(const Msg, CurDir: string; OriginalIndex: integer); virtual; abstract;
property Lines[Index: integer]: TIDEMessageLine read GetLines; default;
function LinesCount: integer; virtual; abstract;
end;
var