added parameter to CreatPublishedMethod to only use the typeinfo, improvements for 64bit

git-svn-id: trunk@9463 -
This commit is contained in:
mattias 2006-06-21 18:30:24 +00:00
parent c3e60040cf
commit 9e7d3f95e3
19 changed files with 432 additions and 57 deletions

2
.gitattributes vendored
View File

@ -60,6 +60,8 @@ components/codetools/customcodetool.pas svneol=native#text/pascal
components/codetools/definetemplates.pas svneol=native#text/pascal
components/codetools/directorycacher.pas svneol=native#text/plain
components/codetools/eventcodetool.pas svneol=native#text/pascal
components/codetools/examples/addmethod.lpi svneol=native#text/plain
components/codetools/examples/addmethod.lpr svneol=native#text/plain
components/codetools/examples/finddeclaration.lpi svneol=native#text/plain
components/codetools/examples/finddeclaration.lpr svneol=native#text/plain
components/codetools/examples/fixfilenames.lpi svneol=native#text/plain

View File

@ -553,7 +553,8 @@ type
const AClassName, OldMethodName,
NewMethodName: string): boolean;
function CreatePublishedMethod(Code: TCodeBuffer; const AClassName,
NewMethodName: string; ATypeInfo: PTypeInfo): boolean;
NewMethodName: string; ATypeInfo: PTypeInfo;
UseTypeInfoForParameters: boolean = false): boolean;
// IDE % directives
function GetIDEDirectives(Code: TCodeBuffer;
@ -2509,7 +2510,8 @@ begin
end;
function TCodeToolManager.CreatePublishedMethod(Code: TCodeBuffer;
const AClassName, NewMethodName: string; ATypeInfo: PTypeInfo): boolean;
const AClassName, NewMethodName: string; ATypeInfo: PTypeInfo;
UseTypeInfoForParameters: boolean): boolean;
begin
{$IFDEF CTDEBUG}
DebugLn('TCodeToolManager.CreatePublishedMethod A');
@ -2519,7 +2521,7 @@ begin
try
SourceChangeCache.Clear;
Result:=FCurCodeTool.CreatePublishedMethod(UpperCaseStr(AClassName),
NewMethodName,ATypeInfo,SourceChangeCache);
NewMethodName,ATypeInfo,SourceChangeCache,UseTypeInfoForParameters);
except
on e: Exception do Result:=HandleException(e);
end;

View File

@ -86,10 +86,12 @@ type
SourceChangeCache: TSourceChangeCache): boolean;
function CreatePublishedMethod(const UpperClassName,
AMethodName: string; ATypeInfo: PTypeInfo;
SourceChangeCache: TSourceChangeCache): boolean;
SourceChangeCache: TSourceChangeCache;
UseTypeInfoForParameters: boolean = false): boolean;
function CreatePublishedMethod(ClassNode: TCodeTreeNode;
const AMethodName: string; ATypeInfo: PTypeInfo;
SourceChangeCache: TSourceChangeCache): boolean;
SourceChangeCache: TSourceChangeCache;
UseTypeInfoForParameters: boolean = false): boolean;
function CreateExprListFromMethodTypeData(TypeData: PTypeData;
Params: TFindDeclarationParams): TExprTypeList;
@ -123,17 +125,27 @@ type
var i, ParamCount, Len, Offset: integer;
ParamType: TParamType;
s, ParamString: string;
s, ParamString, ResultType: string;
begin
Result:='';
if TypeData=nil then exit;
if phpWithStart in Attr then begin
case TypeData^.MethodKind of
mkProcedure: Result:=Result+'procedure ';
mkFunction: Result:=Result+'function ';
mkConstructor: Result:=Result+'constructor ';
mkDestructor: Result:=Result+'destructor ';
mkClassProcedure: Result:=Result+'class procedure ';
mkClassFunction: Result:=Result+'class function ';
end;
end;
// transform TypeData into a ProcHead String
ParamCount:=TypeData^.ParamCount;
//DebugLn('TEventsCodeTool.MethodTypeDataToStr A ParamCount=',ParamCount);
Offset:=0;
if ParamCount>0 then begin
Result:=Result+'(';
ParamString:='';
Offset:=0;
for i:=0 to ParamCount-1 do begin
// read ParamFlags
// ToDo: check this: SizeOf(TParamFlags) is 4, but the data is only 1 byte
@ -181,6 +193,14 @@ begin
end;
Result:=Result+ParamString+')';
end;
if phpWithResultType in Attr then begin
Len:=ord(TypeData^.ParamList[Offset]);
inc(Offset);
SetLength(ResultType,Len);
Move(TypeData^.ParamList[Offset],ResultType[1],Len);
inc(Offset,Len);
Result:=Result+':'+ResultType;
end;
if phpInUpperCase in Attr then Result:=UpperCaseStr(Result);
Result:=Result+';';
end;
@ -551,49 +571,70 @@ end;
function TEventsCodeTool.CreatePublishedMethod(const UpperClassName,
AMethodName: string; ATypeInfo: PTypeInfo;
SourceChangeCache: TSourceChangeCache): boolean;
SourceChangeCache: TSourceChangeCache;
UseTypeInfoForParameters: boolean): boolean;
var AClassNode: TCodeTreeNode;
begin
BuildTree(false);
if not EndOfSourceFound then exit;
AClassNode:=FindClassNodeInInterface(UpperClassName,true,false,true);
Result:=CreatePublishedMethod(AClassNode,AMethodName,ATypeInfo,
SourceChangeCache);
SourceChangeCache,UseTypeInfoForParameters);
end;
function TEventsCodeTool.CreatePublishedMethod(ClassNode: TCodeTreeNode;
const AMethodName: string; ATypeInfo: PTypeInfo;
SourceChangeCache: TSourceChangeCache): boolean;
SourceChangeCache: TSourceChangeCache; UseTypeInfoForParameters: boolean
): boolean;
var
CleanMethodDefinition, MethodDefinition: string;
FindContext: TFindContext;
ATypeData: PTypeData;
begin
try
Result:=false;
if (ClassNode=nil) or (ClassNode.Desc<>ctnClass) or (AMethodName='')
or (ATypeInfo=nil) or (SourceChangeCache=nil) or (Scanner=nil) then exit;
{$IFDEF CTDEBUG}
{ $IFDEF CTDEBUG}
DebugLn('[TEventsCodeTool.CreatePublishedMethod] A AMethodName="',AMethodName,'" in "',MainFilename,'"');
{$ENDIF}
// search typeinfo in source
FindContext:=FindMethodTypeInfo(ATypeInfo);
{ $ENDIF}
DebugLn(['TEventsCodeTool.CreatePublishedMethod UseTypeInfoForParameters=',UseTypeInfoForParameters]);
// initialize class for code completion
CodeCompleteClassNode:=ClassNode;
CodeCompleteSrcChgCache:=SourceChangeCache;
// check if method definition already exists in class
CleanMethodDefinition:=UpperCaseStr(AMethodName)
+FindContext.Tool.ExtractProcHead(FindContext.Node,
[phpWithoutClassName, phpWithoutName, phpInUpperCase]);
if UseTypeInfoForParameters then begin
// do not lookup the declaration in the source
ATypeData:=GetTypeData(ATypeInfo);
if ATypeData=nil then exit(false);
CleanMethodDefinition:=UpperCaseStr(AMethodName)
+MethodTypeDataToStr(ATypeData,
[phpWithoutClassName, phpWithoutName, phpInUpperCase]);
DebugLn(['TEventsCodeTool.CreatePublishedMethod CleanMethodDefinition="',CleanMethodDefinition,'"']);
end else begin
// search typeinfo in source
FindContext:=FindMethodTypeInfo(ATypeInfo);
CleanMethodDefinition:=UpperCaseStr(AMethodName)
+FindContext.Tool.ExtractProcHead(FindContext.Node,
[phpWithoutClassName, phpWithoutName, phpInUpperCase]);
end;
if not ProcExistsInCodeCompleteClass(CleanMethodDefinition) then begin
{$IFDEF CTDEBUG}
DebugLn('[TEventsCodeTool.CreatePublishedMethod] insert method definition to class');
{$ENDIF}
// insert method definition into class
MethodDefinition:=TrimCodeSpace(FindContext.Tool.ExtractProcHead(
FindContext.Node,
[phpWithStart, phpWithoutClassKeyword, phpWithoutClassName,
phpWithoutName, phpWithVarModifiers, phpWithParameterNames,
phpWithDefaultValues, phpWithResultType]));
if UseTypeInfoForParameters then begin
MethodDefinition:=MethodTypeDataToStr(ATypeData,
[phpWithStart, phpWithoutClassKeyword, phpWithoutClassName,
phpWithoutName, phpWithVarModifiers, phpWithParameterNames,
phpWithDefaultValues, phpWithResultType]);
end else begin
MethodDefinition:=TrimCodeSpace(FindContext.Tool.ExtractProcHead(
FindContext.Node,
[phpWithStart, phpWithoutClassKeyword, phpWithoutClassName,
phpWithoutName, phpWithVarModifiers, phpWithParameterNames,
phpWithDefaultValues, phpWithResultType]));
end;
MethodDefinition:=SourceChangeCache.BeautifyCodeOptions.
AddClassAndNameToProc(MethodDefinition, '', AMethodName);
{$IFDEF CTDEBUG}

View File

@ -0,0 +1,127 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<Version Value="5"/>
<General>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/>
<ActiveEditorIndexAtStart Value="1"/>
</General>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="9">
<Unit0>
<Filename Value="addmethod.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="AddMethod"/>
<CursorPos X="11" Y="34"/>
<TopLine Value="10"/>
<EditorIndex Value="0"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="finddeclaration.lpr"/>
<UnitName Value="FindDeclaration"/>
<CursorPos X="1" Y="85"/>
<TopLine Value="38"/>
<UsageCount Value="10"/>
</Unit1>
<Unit2>
<Filename Value="scanexamples/simpleunit1.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="SimpleUnit1"/>
<CursorPos X="11" Y="32"/>
<TopLine Value="1"/>
<EditorIndex Value="6"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="../stdcodetools.pas"/>
<UnitName Value="StdCodeTools"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit3>
<Unit4>
<Filename Value="../eventcodetool.pas"/>
<UnitName Value="EventCodeTool"/>
<CursorPos X="1" Y="623"/>
<TopLine Value="606"/>
<EditorIndex Value="3"/>
<UsageCount Value="10"/>
<Bookmarks Count="1">
<Item0 X="30" Y="620" ID="0"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="../../../../../fpc_sources/20/fpc/rtl/objpas/typinfo.pp"/>
<UnitName Value="typinfo"/>
<CursorPos X="17" Y="121"/>
<TopLine Value="88"/>
<EditorIndex Value="5"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="../codetoolmanager.pas"/>
<UnitName Value="CodeToolManager"/>
<CursorPos X="29" Y="2523"/>
<TopLine Value="2512"/>
<EditorIndex Value="2"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit6>
<Unit7>
<Filename Value="../pascalreadertool.pas"/>
<UnitName Value="PascalReaderTool"/>
<CursorPos X="12" Y="1197"/>
<TopLine Value="1187"/>
<EditorIndex Value="4"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit7>
<Unit8>
<Filename Value="../../../ide/main.pp"/>
<UnitName Value="Main"/>
<CursorPos X="1" Y="1077"/>
<TopLine Value="1037"/>
<EditorIndex Value="1"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit8>
</Units>
<JumpHistory Count="1" HistoryIndex="0">
<Position1>
<Filename Value="../../../ide/main.pp"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position1>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
<OtherUnitFiles Value="$(LazarusDir)/components/codetools/units/$(TargetCPU)-$(TargetOS)/;scanexamples/"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@ -0,0 +1,60 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
Abstract:
Simple demonstrating, how to add a method to a class.
}
program AddMethod;
{$mode objfpc}{$H+}
uses
Classes, SysUtils, CodeCache, CodeToolManager, SimpleUnit1, FileProcs;
type
TMyMethodType = function(Sender: TObject; AValue: integer): string of object;
var
Code: TCodeBuffer;
Filename: string;
begin
// Example: find declaration of 'TObject'
// Step 1: load the file
Filename:=AppendPathDelim(GetCurrentDir)
+'scanexamples'+PathDelim+'simpleunit1.pas';
Code:=CodeToolBoss.LoadFile(Filename,false,false);
if Code=nil then
raise Exception.Create('loading failed '+Filename);
// Step 2: add a method
if CodeToolBoss.CreatePublishedMethod(Code,'TMyClass','NewMethod',
typeinfo(TMyMethodType),true) then
begin
writeln('Method added: ');
writeln(Code.Source);
end else begin
writeln('Adding method failed: ',CodeToolBoss.ErrorMessage);
end;
end.

View File

@ -958,18 +958,128 @@ function TMethodJumpingCodeTool.FindJumpPointForLinkerPos(
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
SUBBY
Unit name and parent procedues are missing.
}
var
ProcName: String;
BestProcNode: TCodeTreeNode;
ProcPos: integer;
function FindFirstIdentifier(const Identifier: string): boolean;
begin
ProcPos:=1;
while (ProcPos<=length(ProcName))
and (not IsIdentStartChar[ProcName[ProcPos]]) do
inc(ProcPos);
Result:=BasicCodeTools.CompareIdentifiers(@ProcName[ProcPos],
PChar(Pointer(Identifier)))=0;
end;
function FindNextIdentifier(const Identifier: string): boolean;
begin
while (ProcPos<=length(ProcName)) and (IsIdentChar[ProcName[ProcPos]]) do
inc(ProcPos);
while (ProcPos<=length(ProcName))
and (not IsIdentStartChar[ProcName[ProcPos]]) do
inc(ProcPos);
Result:=BasicCodeTools.CompareIdentifiers(@ProcName[ProcPos],
PChar(Pointer(Identifier)))=0;
end;
function SearchNode(Node: TCodeTreeNode): boolean;
var
CurProcName: String;
p: LongInt;
CurClassName: String;
begin
Result:=false;
while Node<>nil do begin
if Node.Desc=ctnProcedure then begin
CurProcName:=ExtractProcName(Node,[phpInUpperCase]);
p:=System.Pos('.',CurProcName);
if p>0 then begin
// classname.procname
CurClassName:=copy(CurProcName,1,p-1);
CurProcName:=copy(CurProcName,p+1,length(CurProcName));
if FindFirstIdentifier(CurClassName)
and FindNextIdentifier(CurProcName) then begin
// proc found
BestProcNode:=Node;
Result:=true;
end;
end else begin
// procname
if FindFirstIdentifier(CurProcName) then begin
// proc found
BestProcNode:=Node;
Result:=true;
end;
end;
end;
if Node.Desc in ([ctnImplementation,ctnProcedure]+AllSourceTypes) then
SearchNode(Node.FirstChild);
Node:=Node.NextBrother;
end;
end;
var
CurSourceName: String;
p: LongInt;
ShortIdentifier: ShortString;
BestPos: Integer;
begin
Result:=false;
BuildTree(false);
DebugLn(['TMethodJumpingCodeTool.FindJumpPointForLinkerPos ']);
ProcName:=MangledFunction;
ProcPos:=1;
// remove unitname from ProcName
CurSourceName:=GetSourceName(false);
p:=System.Pos('_',ProcName);
if p>0 then begin
while (p<=length(ProcName)) and (ProcName[p]='_') do inc(p);
ProcName:=copy(ProcName,p,length(ProcName));
end;
// find procedure
BestProcNode:=nil;
BestPos:=0;
Result:=SearchNode(Tree.Root);
ShortIdentifier:=UpperCaseStr(copy(Identifier,1,255));
if BestProcNode<>nil then begin
if Identifier<>'' then begin
MoveCursorToCleanPos(BestProcNode.StartPos);
repeat
ReadNextAtom;
if (CurPos.StartPos>SrcLen) or (CurPos.StartPos>BestProcNode.EndPos)
then
break;
if UpAtomIs(ShortIdentifier) then begin
BestPos:=CurPos.StartPos;
break;
end;
until false;
end else begin
BestPos:=BestProcNode.StartPos;
end;
end;
if BestPos<1 then exit;
// find jump point
Result:=JumpToCleanPos(BestPos,-1,-1,NewPos,NewTopLine,false);
end;
procedure TMethodJumpingCodeTool.WriteCodeTreeNodeExtTree(ExtTree: TAVLTree);

View File

@ -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.0.0.2
override PACKAGE_VERSION=0.5
ifndef LCL_PLATFORM
ifeq ($(OS_TARGET),win32)
LCL_PLATFORM=win32

View File

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

View File

@ -233,7 +233,7 @@ begin
exit;
Data:=VirtualKeyStrings.Data[s];
if Data<>nil then
Result:=integer(Data);
Result:=word(Data);
end;
procedure GetDefaultKeyForCommand(Command: word;

View File

@ -47,9 +47,9 @@ uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
{$IFDEF IDE_MEM_CHECK}
{ $IFDEF IDE_MEM_CHECK}
MemCheck,
{$ENDIF}
{ $ENDIF}
Interfaces,
Forms, LCLProc,
Splash,

View File

@ -190,14 +190,18 @@ constructor TQuickFixLinkerUndefinedReference.Create;
begin
Name:='Linker: undefined reference to';
Steps:=[imqfoJump];
RegExpression:='^(: .* `(.*)'')|((.*)\(\.text.*?\): .* `([A-Z0-9_$]+)'':)$';
RegExpression:='^((.*:[0-9]+)?: .* `(.*)'')|((.*)\(\.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'
{ Examples:
/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'
unit1.o(.text+0x1a): In function `SubProc':
unit1.pas:37: undefined reference to `DoesNotExist'
unit1.o(.text+0x3a):unit1.pas:48: undefined reference to `DoesNotExist'
}
procedure Error(const Msg: string);
@ -219,13 +223,30 @@ procedure TQuickFixLinkerUndefinedReference.Execute(const Msg: TIDEMessageLine;
AnUnitName: String;
begin
DebugLn(['JumpTo START ',Line1.Msg]);
if not REMatches(Line1.Msg,'^(.*)\(\.text.*?\): .* `([A-Z0-9_$]+)'':$')
then
if REMatches(Line1.Msg,'^(.*)\(\.text.*?\): .* `([A-Z0-9_$]+)'':$') then
begin
Filename:=REVar(1);
MangledFunction:=REVar(2);
end
else if REMatches(Line1.Msg,'^(.*)\(\.text.*?\):.*:([0-9]*): .* `([A-Z0-9_$]+)'':$')
then begin
Filename:=REVar(1);
//LineNumber:=StrToIntDef(REVar(2),0);
MangledFunction:=REVar(3);
end else begin
DebugLn('JumpTo Line1 does not match: "',Line1.Msg,'"');
exit;
Filename:=REVar(1);
MangledFunction:=REVar(2);
if not REMatches(Line2.Msg,'^: .* `(.*)''$') then exit;
Identifier:=REVar(1);
end;
if REMatches(Line2.Msg,'^: .* `(.*)''$') then begin
// no source position
Identifier:=REVar(1);
end else if REMatches(Line2.Msg,'^.*:([0-9]+): .* `(.*)''$') then begin
// with source position
Identifier:=REVar(2);
end else begin
DebugLn('JumpTo Line2 does not match: "',Line2.Msg,'"');
exit;
end;
DebugLn(['TQuickFixLinkerUndefinedReference.JumpTo Filename="',Filename,'" MangledFunction="',MangledFunction,'" Identifier="',Identifier,'"']);
CurProject:=LazarusIDE.ActiveProject;
if CurProject=nil then begin
@ -254,7 +275,10 @@ procedure TQuickFixLinkerUndefinedReference.Execute(const Msg: TIDEMessageLine;
if not CodeToolBoss.JumpToLinkerIdentifier(CodeBuf,
MangledFunction,Identifier,NewCode,NewX,NewY,NewTopLine)
then begin
Error('function not found: '+MangledFunction+' Identifier='+Identifier);
if CodeToolBoss.ErrorCode<>nil then
LazarusIDE.DoJumpToCodeToolBossError
else
Error('function not found: '+MangledFunction+' Identifier='+Identifier);
exit;
end;
LazarusIDE.DoOpenFileAndJumpToPos(NewCode.Filename,Point(NewX,NewY),
@ -265,10 +289,15 @@ 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
if (Msg.Position>0) and REMatches(Msg.Msg,'^(.*:[0-9]+)?: .* `(.*)''$') then
// example: unit1.pas:37: undefined reference to `DoesNotExist'
JumpTo(IDEMessagesWindow[Msg.Position-1],Msg)
else if (Msg.Position<IDEMessagesWindow.LinesCount-1)
and REMatches(Msg.Msg,'^(.*)\(\.text.*?\): .* `([A-Z0-9_$]+)'':$') then
// example: unit1.o(.text+0x1a): In function `SubProc':
JumpTo(Msg,IDEMessagesWindow[Msg.Position+1])
else if REMatches(Msg.Msg,'^(.*)\(\.text.*?\): .* `([A-Z0-9_$]+)'':$') then
// unit1.o(.text+0x3a):unit1.pas:48: undefined reference to `DoesNotExist'
JumpTo(Msg,IDEMessagesWindow[Msg.Position+1]);
end;
end;

View File

@ -27,8 +27,10 @@ unit OutputFilter;
interface
// TODO: Test on all platforms
{$IFDEF Linux}
{$DEFINE UseAsyncProcess}
{$IFNDEF DisableAsyncProcess}
{$IFDEF Linux}
{$DEFINE UseAsyncProcess}
{$ENDIF}
{$ENDIF}
uses

View File

@ -1,2 +1,2 @@
// Created by Svn2RevisionInc
const RevisionStr = '9370M';
const RevisionStr = '9462M';

View File

@ -459,7 +459,7 @@ begin
end;
if i=FLastIndex then
dec(DataCount,FLastItemSpace);
writeln(i,' Item=',HexStr(Cardinal(FItems[i]),8),' Size=',fItems[i]^.Size,' Start=',DataOffset,' Count=',DataCount);
writeln(i,' Item=',HexStr(PtrInt(FItems[i]),8),' Size=',fItems[i]^.Size,' Start=',DataOffset,' Count=',DataCount);
if WriteData then begin
writeln(dbgMemRange(PByte(@FItems[i]^.Data)+DataOffset,DataCount));
end;

View File

@ -41,8 +41,10 @@ interface
// This is the old mode and might be removed
// TODO: Test on all platforms
{$IFDEF Linux}
{$Define UseAsyncProcess}
{$IFNDEF DisableAsyncProcess}
{$IFDEF Linux}
{$DEFINE UseAsyncProcess}
{$ENDIF}
{$ENDIF}
{$IFDEF win32}

View File

@ -240,6 +240,7 @@ begin
{$ifdef Unix}
InitSynchronizeSupport;
{$ifdef UseAsyncProcess}
DebugLn(['TGtkWidgetSet.Create Installing signal handler for TAsyncProcess']);
InstallSignalHandler;
{$endif}
{$endif}

View File

@ -6648,22 +6648,21 @@ end;
function MessageButtonClicked(Widget : PGtkWidget; data: gPointer) : GBoolean; cdecl;
begin
//DebugLn('[MessageButtonClicked] ',dbgs(data),' ',dbgs(gtk_object_get_data(PGtkObject(Widget), 'modal_result')));
if Integer(data^) = 0 then
Integer(data^):=
Integer(gtk_object_get_data(PGtkObject(Widget), 'modal_result'));
if PInteger(data)^ = 0 then
PInteger(data)^:=PtrInt(gtk_object_get_data(PGtkObject(Widget), 'modal_result'));
Result:=false;
end;
function MessageBoxClosed(Widget : PGtkWidget; Event : PGdkEvent;
data: gPointer) : GBoolean; cdecl;
var ModalResult : integer;
var ModalResult : PtrInt;
begin
{ We were requested by window manager to close }
if Integer(data^) = 0 then begin
ModalResult:= Integer(gtk_object_get_data(PGtkObject(Widget), 'modal_result'));
if PInteger(data)^ = 0 then begin
ModalResult:= PtrInt(gtk_object_get_data(PGtkObject(Widget), 'modal_result'));
{ Don't allow to close if we don't have a default return value }
Result:= (ModalResult = 0);
if not Result then Integer(data^):= ModalResult
if not Result then PInteger(data)^:= ModalResult
else DebugLn('Do not close !!!');
end else Result:= false;
end;

View File

@ -750,7 +750,7 @@ begin
// check if the row is are already selected
// since we are in singleselect, the first item is checked
if (CListWidget^.selection <> nil)
and (Integer(CListWidget^.selection^.Data) = AIndex)
and (PtrInt(CListWidget^.selection^.Data) = AIndex)
then Exit;
gtk_clist_unselect_all(CListWidget);
end;
@ -1047,7 +1047,7 @@ begin
if CListWidget^.selection = nil
then Result := -1
else Result := Integer(CListWidget^.selection^.data);
else Result := PtrInt(CListWidget^.selection^.data)
end;
class function TGtkWSCustomListView.GetTopItem(const ALV: TCustomListView): Integer;

View File

@ -367,7 +367,7 @@ begin
if GList = nil then
Result := -1
else
Result := integer(GList^.Data);
Result := PtrInt(GList^.Data);
end;
end;
{!$EndIf}
@ -415,7 +415,7 @@ begin
Widget:=GetWidgetInfo(Pointer(Handle),True)^.CoreWidget;
GList:= PGtkCList(Widget)^.selection;
while Assigned(GList) do begin
if integer(GList^.data) = AIndex then begin
if PtrInt(GList^.data) = AIndex then begin
Result:=true;
exit;
end else