mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 04:19:19 +02:00
* fixed stronger fpc typing (and some real cast errors)
git-svn-id: trunk@6195 -
This commit is contained in:
parent
f463f92baa
commit
fee93ccea9
@ -2301,6 +2301,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function CompareIdentifierPtrs(Identifier1, Identifier2: Pointer): integer;
|
||||
begin
|
||||
Result := CompareIdentifiers(PChar(Identifier1), PChar(Identifier2));
|
||||
end;
|
||||
|
||||
function CompareIdentifiersCaseSensitive(Identifier1, Identifier2: PChar
|
||||
): integer;
|
||||
begin
|
||||
|
@ -1043,9 +1043,10 @@ begin
|
||||
Tree.Free;
|
||||
end;
|
||||
|
||||
|
||||
function TCodeToolManager.CreateTreeOfPCodeXYPosition: TAVLTree;
|
||||
begin
|
||||
Result:=TAVLTree.Create(@CompareCodeXYPositions);
|
||||
Result:=TAVLTree.Create(TListSortCompare(@CompareCodeXYPositions));
|
||||
end;
|
||||
|
||||
procedure TCodeToolManager.AddListToTreeOfPCodeXYPosition(SrcList: TList;
|
||||
|
@ -115,6 +115,7 @@ var
|
||||
cmp: Integer;
|
||||
begin
|
||||
cmp:=V2.Node.StartPos-V1.Node.StartPos;
|
||||
|
||||
if cmp<0 then
|
||||
Result:=-1
|
||||
else if cmp>0 then
|
||||
@ -250,8 +251,8 @@ var
|
||||
' ParameterType=',ParameterTypeNames[ParameterType]);
|
||||
{$ENDIF}
|
||||
if VarTree=nil then
|
||||
VarTree:=TAVLTree.Create(@CompareExtractedProcVariables);
|
||||
AVLNode:=VarTree.FindKey(VarNode,@CompareNodeWithExtractedProcVariable);
|
||||
VarTree:=TAVLTree.Create(TListSortCompare(@CompareExtractedProcVariables));
|
||||
AVLNode:=VarTree.FindKey(VarNode,TListSortCompare(@CompareNodeWithExtractedProcVariable));
|
||||
if AVLNode<>nil then begin
|
||||
ProcVar:=TExtractedProcVariable(AVLNode.Data);
|
||||
end else begin
|
||||
@ -483,7 +484,7 @@ var
|
||||
AVLNode: TAVLTreeNode;
|
||||
begin
|
||||
CurProcVar:=nil;
|
||||
AVLNode:=VarTree.FindKey(VarNode,@CompareNodeWithExtractedProcVariable);
|
||||
AVLNode:=VarTree.FindKey(VarNode, TListSortCompare(@CompareNodeWithExtractedProcVariable));
|
||||
if AVLNode=nil then begin
|
||||
Result:=false;
|
||||
end else begin
|
||||
|
@ -1757,8 +1757,16 @@ function TLinkScanner.GuessMisplacedIfdefEndif(StartCursorPos: integer;
|
||||
|
||||
function ReadDirectiveType(const ASrc: string;
|
||||
AToken: TToken): TDirectiveType;
|
||||
const
|
||||
DIR_RST: array[0..5] of TDirectiveType = (
|
||||
dtIfDef, dtIfNDef, dtIfOpt, dtIf, dtElse, dtEndif
|
||||
);
|
||||
DIR_TXT: array[0..5] of PChar = (
|
||||
'IFDEF', 'IFNDEF', 'IFOPT', 'IF', 'ELSE', 'ENDIF'
|
||||
);
|
||||
var
|
||||
ASrcLen, p: integer;
|
||||
n: Integer;
|
||||
begin
|
||||
Result:=dtUnknown;
|
||||
ASrcLen:=length(ASrc);
|
||||
@ -1767,18 +1775,14 @@ function TLinkScanner.GuessMisplacedIfdefEndif(StartCursorPos: integer;
|
||||
begin
|
||||
// compiler directive
|
||||
inc(p);
|
||||
if CompareIdentifiers(@ASrc[p],'IFDEF')=0 then
|
||||
Result:=dtIfDef
|
||||
else if CompareIdentifiers(@ASrc[p],'IFNDEF')=0 then
|
||||
Result:=dtIfNDef
|
||||
else if CompareIdentifiers(@ASrc[p],'IF')=0 then
|
||||
Result:=dtIf
|
||||
else if CompareIdentifiers(@ASrc[p],'IFOPT')=0 then
|
||||
Result:=dtIfOpt
|
||||
else if CompareIdentifiers(@ASrc[p],'ELSE')=0 then
|
||||
Result:=dtElse
|
||||
else if CompareIdentifiers(@ASrc[p],'ENDIF')=0 then
|
||||
Result:=dtEndif;
|
||||
for n := Low(DIR_TXT) to High(DIR_TXT) do
|
||||
begin
|
||||
if CompareIdentifiers(@ASrc[p], DIR_TXT[n]) = 0
|
||||
then begin
|
||||
Result := DIR_RST[n];
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -2153,7 +2153,7 @@ begin
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
CurIdentNode:=
|
||||
IdentTree.FindKey(@Src[CurPos.StartPos],@CompareIdentifiers);
|
||||
IdentTree.FindKey(@Src[CurPos.StartPos], TListSortCompare(@CompareIdentifiers));
|
||||
if CurIdentNode<>nil then begin
|
||||
CurDiff:=CurPos.StartPos-CleanCursorPos;
|
||||
if CurDiff<0 then CurDiff:=-CurDiff;
|
||||
@ -2992,7 +2992,7 @@ begin
|
||||
while ANode<>nil do begin
|
||||
if (ANode.Desc=ctnConstDefinition) then begin
|
||||
if IdentTree=nil then
|
||||
IdentTree:=TAVLTree.Create(@BasicCodeTools.CompareIdentifiers);
|
||||
IdentTree:=TAVLTree.Create(TListSortCompare(@BasicCodeTools.CompareIdentifiers));
|
||||
IdentTree.Add(@Src[ANode.StartPos]);
|
||||
end;
|
||||
ANode:=ANode.NextBrother;
|
||||
|
@ -427,7 +427,7 @@ var
|
||||
begin
|
||||
// create/clear tree
|
||||
if FClasses=nil then
|
||||
FClasses:=TAvgLvlTree.CreateObjectCompare(@CompareClasses)
|
||||
FClasses:=TAvgLvlTree.CreateObjectCompare(TObjectSortCompare(@CompareClasses))
|
||||
else
|
||||
FClasses.Clear;
|
||||
// add class of ThePersistent
|
||||
|
@ -53,7 +53,7 @@ type
|
||||
TOnPersistentAdded = procedure(Sender: TObject; APersistent: TPersistent;
|
||||
ComponentClass: TRegisteredComponent) of object;
|
||||
TOnPasteComponent = procedure(Sender: TObject; LookupRoot: TComponent;
|
||||
TxtCompStream: TStream; Parent: TComponent;
|
||||
TxtCompStream: TStream; Parent: TWinControl;
|
||||
var NewComponent: TComponent) of object;
|
||||
TOnRemovePersistent = procedure(Sender: TObject; APersistent: TPersistent)
|
||||
of object;
|
||||
@ -175,10 +175,10 @@ type
|
||||
Procedure NudgeSize(DiffX, DiffY: Integer);
|
||||
procedure SelectParentOfSelection;
|
||||
function DoCopySelectionToClipboard: boolean;
|
||||
function GetPasteParent: TComponent;
|
||||
function GetPasteParent: TWinControl;
|
||||
function DoPasteSelectionFromClipboard(PasteFlags: TComponentPasteSelectionFlags
|
||||
): boolean;
|
||||
function DoInsertFromStream(s: TStream; PasteParent: TComponent;
|
||||
function DoInsertFromStream(s: TStream; PasteParent: TWinControl;
|
||||
PasteFlags: TComponentPasteSelectionFlags): Boolean;
|
||||
procedure DoShowTabOrderEditor;
|
||||
procedure DoShowChangeClassDialog;
|
||||
@ -226,7 +226,7 @@ type
|
||||
function PasteSelection(PasteFlags: TComponentPasteSelectionFlags): boolean; override;
|
||||
function DeleteSelection: boolean; override;
|
||||
function CopySelectionToStream(AllComponentsStream: TStream): boolean; override;
|
||||
function InsertFromStream(s: TStream; Parent: TComponent;
|
||||
function InsertFromStream(s: TStream; Parent: TWinControl;
|
||||
PasteFlags: TComponentPasteSelectionFlags): Boolean; override;
|
||||
function InvokeComponentEditor(AComponent: TComponent;
|
||||
MenuIndex: integer): boolean; override;
|
||||
@ -517,7 +517,7 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TDesigner.InsertFromStream(s: TStream; Parent: TComponent;
|
||||
function TDesigner.InsertFromStream(s: TStream; Parent: TWinControl;
|
||||
PasteFlags: TComponentPasteSelectionFlags): Boolean;
|
||||
begin
|
||||
Result:=DoInsertFromStream(s,Parent,PasteFlags);
|
||||
@ -559,7 +559,7 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TDesigner.GetPasteParent: TComponent;
|
||||
function TDesigner.GetPasteParent: TWinControl;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -602,7 +602,7 @@ begin
|
||||
end;
|
||||
|
||||
function TDesigner.DoInsertFromStream(s: TStream;
|
||||
PasteParent: TComponent; PasteFlags: TComponentPasteSelectionFlags): Boolean;
|
||||
PasteParent: TWinControl; PasteFlags: TComponentPasteSelectionFlags): Boolean;
|
||||
var
|
||||
AllComponentText: string;
|
||||
StartPos: Integer;
|
||||
|
@ -136,7 +136,7 @@ type
|
||||
procedure InsertFromTemplateClick(Sender: TObject);
|
||||
procedure SaveAsTemplateClick(Sender: TObject);
|
||||
procedure DeleteFromTemplateClick(Sender: TObject);
|
||||
procedure OnComponentModified(Sender: TComponent);
|
||||
procedure OnComponentModified(Sender: TObject);
|
||||
|
||||
// Functions for editing menus
|
||||
function AddNewItemBefore(MenuItem: PDesignerMenuItem; Ident: string): PDesignerMenuItem;
|
||||
@ -1268,7 +1268,7 @@ end;
|
||||
// --------------------------------------------------------------------------------------------------------------//
|
||||
// Some property og some object has changed -> we need to know if caption of some menuitem has changed ----------//
|
||||
// --------------------------------------------------------------------------------------------------------------//
|
||||
procedure TDesignerMainMenu.OnComponentModified(Sender: TComponent);
|
||||
procedure TDesignerMainMenu.OnComponentModified(Sender: TObject);
|
||||
var
|
||||
Selection: TPersistentSelectionList;
|
||||
i: Integer;
|
||||
|
@ -149,7 +149,7 @@ each control that's dropped onto the form
|
||||
): TIComponentInterface; override;
|
||||
Function FindComponent(AComponent: TComponent): TIComponentInterface; override;
|
||||
function SaveSelectionToStream(s: TStream): Boolean; override;
|
||||
function InsertFromStream(s: TStream; Parent: TComponent;
|
||||
function InsertFromStream(s: TStream; Parent: TWinControl;
|
||||
Flags: TComponentPasteSelectionFlags): Boolean; override;
|
||||
function ClearSelection: Boolean; override;
|
||||
function DeleteSelection: Boolean; override;
|
||||
@ -881,7 +881,7 @@ begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TCustomFormEditor.InsertFromStream(s: TStream; Parent: TComponent;
|
||||
function TCustomFormEditor.InsertFromStream(s: TStream; Parent: TWinControl;
|
||||
Flags: TComponentPasteSelectionFlags): Boolean;
|
||||
var
|
||||
ADesigner: TIDesigner;
|
||||
@ -1521,9 +1521,9 @@ var
|
||||
begin
|
||||
IsDefined:=false;
|
||||
if FDefineProperties=nil then
|
||||
FDefineProperties:=TAVLTree.Create(@CompareDefPropCacheItems);
|
||||
FDefineProperties:=TAVLTree.Create(TListSortCompare(@CompareDefPropCacheItems));
|
||||
ANode:=FDefineProperties.FindKey(PChar(APersistentClassName),
|
||||
@ComparePersClassNameAndDefPropCacheItem);
|
||||
TListSortCompare(@ComparePersClassNameAndDefPropCacheItem));
|
||||
if ANode=nil then begin
|
||||
// cache component class, try to retrieve the define properties
|
||||
CacheItem:=TDefinePropertiesCacheItem.Create;
|
||||
|
@ -74,7 +74,7 @@ end;
|
||||
---------------------------------------------------------------------------}
|
||||
procedure SetPrimaryConfigPath(const NewValue: String);
|
||||
begin
|
||||
PrimaryConfigPath:=FExpand(NewValue);
|
||||
PrimaryConfigPath:=ExpandFileName{FExpand}(NewValue);
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
@ -82,7 +82,7 @@ end;
|
||||
---------------------------------------------------------------------------}
|
||||
procedure SetSecondaryConfigPath(const NewValue: String);
|
||||
begin
|
||||
SecondaryConfigPath:=FExpand(NewValue);
|
||||
SecondaryConfigPath:=ExpandFileName{FExpand}(NewValue);
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
@ -193,7 +193,7 @@ end;
|
||||
---------------------------------------------------------------------------}
|
||||
procedure InternalInit;
|
||||
begin
|
||||
PrimaryConfigPath:=FExpand('~/.lazarus');
|
||||
PrimaryConfigPath:=ExpandFileName{FExpand}('~/.lazarus');
|
||||
SecondaryConfigPath:='/etc/lazarus';
|
||||
end;
|
||||
|
||||
|
@ -1036,8 +1036,8 @@ begin
|
||||
|
||||
//writeln('TMainIDEBase.DoCheckUnitPathForAmbigiousPascalFiles A UnitPath="',UnitPath,'" Ext=',CompiledExt,' Context=',ContextDescription);
|
||||
|
||||
SourceUnitTree:=TAVLTree.Create(@CompareUnitFiles);
|
||||
CompiledUnitTree:=TAVLTree.Create(@CompareUnitFiles);
|
||||
SourceUnitTree:=TAVLTree.Create(TListSortCompare(@CompareUnitFiles));
|
||||
CompiledUnitTree:=TAVLTree.Create(TListSortCompare(@CompareUnitFiles));
|
||||
FileInfoNeedClose:=false;
|
||||
try
|
||||
// collect all units (.pas, .pp, compiled units)
|
||||
@ -1067,7 +1067,7 @@ begin
|
||||
CurFilename:=CurDir+FileInfo.Name;
|
||||
// check if unit already found
|
||||
ANode:=CurUnitTree.FindKey(PChar(CurUnitName),
|
||||
@CompareUnitNameAndUnitFile);
|
||||
TListSortCompare(@CompareUnitNameAndUnitFile));
|
||||
if ANode<>nil then begin
|
||||
// pascal unit exists twice
|
||||
Result:=MessageDlg('Ambigious unit found',
|
||||
|
@ -52,7 +52,7 @@ type
|
||||
function PasteSelection(Flags: TComponentPasteSelectionFlags): boolean; virtual; abstract;
|
||||
function DeleteSelection: boolean; virtual; abstract;
|
||||
function CopySelectionToStream(s: TStream): boolean; virtual; abstract;
|
||||
function InsertFromStream(s: TStream; Parent: TComponent;
|
||||
function InsertFromStream(s: TStream; Parent: TWinControl;
|
||||
Flags: TComponentPasteSelectionFlags
|
||||
): Boolean; virtual; abstract;
|
||||
function InvokeComponentEditor(AComponent: TComponent;
|
||||
|
@ -74,13 +74,13 @@ type
|
||||
function CompareComponentCandidates(
|
||||
Candidate1, Candidate2: TComponentCandidate): integer;
|
||||
begin
|
||||
Result:=ComparePointers(Candidate1.APersistent,Candidate2.APersistent);
|
||||
Result := ComparePointers(Candidate1.APersistent, Candidate2.APersistent);
|
||||
end;
|
||||
|
||||
function ComparePersistentWithComponentCandidate(
|
||||
APersistent: TPersistent; Candidate: TComponentCandidate): integer;
|
||||
begin
|
||||
Result:=ComparePointers(APersistent,Candidate.APersistent);
|
||||
Result := ComparePointers(APersistent, Candidate.APersistent);
|
||||
end;
|
||||
|
||||
{ TComponentTreeView }
|
||||
@ -180,7 +180,7 @@ var
|
||||
CurControl:=AControl.Controls[i];
|
||||
if CurControl.Owner<>AControl.Owner then continue;
|
||||
AVLNode:=Candidates.FindKey(CurControl,
|
||||
@ComparePersistentWithComponentCandidate);
|
||||
TListSortCompare(@ComparePersistentWithComponentCandidate));
|
||||
Candidate:=TComponentCandidate(AVLNode.Data);
|
||||
if Candidate.Added then continue;
|
||||
Candidate.Added:=true;
|
||||
@ -207,7 +207,7 @@ var
|
||||
CurMenuItem:=AMenuItem.Items[i];
|
||||
if CurMenuItem.Owner<>RootComponent then continue;
|
||||
AVLNode:=Candidates.FindKey(CurMenuItem,
|
||||
@ComparePersistentWithComponentCandidate);
|
||||
TListSortCompare(@ComparePersistentWithComponentCandidate));
|
||||
Candidate:=TComponentCandidate(AVLNode.Data);
|
||||
if Candidate.Added then continue;
|
||||
Candidate.Added:=true;
|
||||
@ -239,7 +239,7 @@ begin
|
||||
|
||||
RootObject:=PropertyEditorHook.LookupRoot;
|
||||
if RootObject<>nil then begin
|
||||
Candidates:=TAvgLvlTree.Create(@CompareComponentCandidates);
|
||||
Candidates:=TAvgLvlTree.Create(TListSortCompare(@CompareComponentCandidates));
|
||||
try
|
||||
// first add the lookup root
|
||||
RootNode:=Items.Add(nil,CreateNodeCaption(RootObject));
|
||||
@ -273,7 +273,7 @@ begin
|
||||
for i:=0 to RootComponent.ComponentCount-1 do begin
|
||||
AComponent:=RootComponent.Components[i];
|
||||
AVLNode:=Candidates.FindKey(AComponent,
|
||||
@ComparePersistentWithComponentCandidate);
|
||||
TListSortCompare(@ComparePersistentWithComponentCandidate));
|
||||
Candidate:=TComponentCandidate(AVLNode.Data);
|
||||
if Candidate.Added then
|
||||
continue;
|
||||
|
@ -109,7 +109,7 @@ type
|
||||
|
||||
// selection
|
||||
function SaveSelectionToStream(s: TStream): Boolean; virtual; abstract;
|
||||
function InsertFromStream(s: TStream; Parent: TComponent;
|
||||
function InsertFromStream(s: TStream; Parent: TWinControl;
|
||||
Flags: TComponentPasteSelectionFlags
|
||||
): Boolean; virtual; abstract;
|
||||
function ClearSelection: Boolean; virtual; abstract;
|
||||
|
@ -2575,7 +2575,7 @@ begin
|
||||
try
|
||||
Cnt:=FileCount;
|
||||
for i:=0 to Cnt-1 do NewList.Add(FFiles[i]);
|
||||
NewList.Sort(@ComparePkgFilesAlphabetically);
|
||||
NewList.Sort(TListSortCompare(@ComparePkgFilesAlphabetically));
|
||||
i:=Cnt-1;
|
||||
while (i>=0) and (NewList[i]=FFiles[i]) do dec(i);
|
||||
if i<0 then exit;
|
||||
@ -3525,9 +3525,9 @@ end;
|
||||
|
||||
{ TPkgPairTree }
|
||||
|
||||
function ComparePkgPairs(Pair1, Pair2: TPkgPair): integer;
|
||||
function ComparePkgPairs(Pair1, Pair2: Pointer): integer;
|
||||
begin
|
||||
Result:=Pair1.Compare(Pair2);
|
||||
Result:=TPkgPair(Pair1).Compare(TPkgPair(Pair2));
|
||||
end;
|
||||
|
||||
constructor TPkgPairTree.Create;
|
||||
@ -3604,11 +3604,6 @@ end;
|
||||
|
||||
{ TPkgUnitsTree }
|
||||
|
||||
function ComparePkgFilesUnitname(PkgFile1, PkgFile2: TPkgFile): integer;
|
||||
begin
|
||||
Result:=AnsiCompareText(PkgFile1.UnitName,PkgFile2.UnitName);
|
||||
end;
|
||||
|
||||
function TPkgUnitsTree.FindNodeWithUnitName(const UnitName: string
|
||||
): TAVLTreeNode;
|
||||
var
|
||||
@ -3640,6 +3635,13 @@ begin
|
||||
Result:=TPkgFile(ANode.Data);
|
||||
end;
|
||||
|
||||
function ComparePkgFilesUnitname(PkgFile1, PkgFile2: Pointer): integer;
|
||||
begin
|
||||
Result := AnsiCompareText(
|
||||
TPkgFile(PkgFile1).UnitName,
|
||||
TPkgFile(PkgFile2).UnitName);
|
||||
end;
|
||||
|
||||
constructor TPkgUnitsTree.Create(ThePackage: TLazPackage);
|
||||
begin
|
||||
fLazPackage:=ThePackage;
|
||||
|
@ -1540,9 +1540,9 @@ var
|
||||
begin
|
||||
// for first time: create PackageTreeOfUnitTrees
|
||||
if PackageTreeOfUnitTrees=nil then
|
||||
PackageTreeOfUnitTrees:=TAVLTree.Create(@CompareUnitsTree);
|
||||
PackageTreeOfUnitTrees:=TAVLTree.Create(TListSortCompare(@CompareUnitsTree));
|
||||
// search UnitsTree for package
|
||||
ANode:=PackageTreeOfUnitTrees.FindKey(Pkg,@ComparePackageWithUnitsTree);
|
||||
ANode:=PackageTreeOfUnitTrees.FindKey(Pkg, TListSortCompare(@ComparePackageWithUnitsTree));
|
||||
if ANode<>nil then begin
|
||||
Result:=TPkgUnitsTree(ANode.Data);
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user