* fixed stronger fpc typing (and some real cast errors)

git-svn-id: trunk@6195 -
This commit is contained in:
marc 2004-11-04 01:26:47 +00:00
parent f463f92baa
commit fee93ccea9
16 changed files with 69 additions and 56 deletions

View File

@ -2301,6 +2301,11 @@ begin
end; end;
end; end;
function CompareIdentifierPtrs(Identifier1, Identifier2: Pointer): integer;
begin
Result := CompareIdentifiers(PChar(Identifier1), PChar(Identifier2));
end;
function CompareIdentifiersCaseSensitive(Identifier1, Identifier2: PChar function CompareIdentifiersCaseSensitive(Identifier1, Identifier2: PChar
): integer; ): integer;
begin begin

View File

@ -1043,9 +1043,10 @@ begin
Tree.Free; Tree.Free;
end; end;
function TCodeToolManager.CreateTreeOfPCodeXYPosition: TAVLTree; function TCodeToolManager.CreateTreeOfPCodeXYPosition: TAVLTree;
begin begin
Result:=TAVLTree.Create(@CompareCodeXYPositions); Result:=TAVLTree.Create(TListSortCompare(@CompareCodeXYPositions));
end; end;
procedure TCodeToolManager.AddListToTreeOfPCodeXYPosition(SrcList: TList; procedure TCodeToolManager.AddListToTreeOfPCodeXYPosition(SrcList: TList;

View File

@ -115,6 +115,7 @@ var
cmp: Integer; cmp: Integer;
begin begin
cmp:=V2.Node.StartPos-V1.Node.StartPos; cmp:=V2.Node.StartPos-V1.Node.StartPos;
if cmp<0 then if cmp<0 then
Result:=-1 Result:=-1
else if cmp>0 then else if cmp>0 then
@ -250,8 +251,8 @@ var
' ParameterType=',ParameterTypeNames[ParameterType]); ' ParameterType=',ParameterTypeNames[ParameterType]);
{$ENDIF} {$ENDIF}
if VarTree=nil then if VarTree=nil then
VarTree:=TAVLTree.Create(@CompareExtractedProcVariables); VarTree:=TAVLTree.Create(TListSortCompare(@CompareExtractedProcVariables));
AVLNode:=VarTree.FindKey(VarNode,@CompareNodeWithExtractedProcVariable); AVLNode:=VarTree.FindKey(VarNode,TListSortCompare(@CompareNodeWithExtractedProcVariable));
if AVLNode<>nil then begin if AVLNode<>nil then begin
ProcVar:=TExtractedProcVariable(AVLNode.Data); ProcVar:=TExtractedProcVariable(AVLNode.Data);
end else begin end else begin
@ -483,7 +484,7 @@ var
AVLNode: TAVLTreeNode; AVLNode: TAVLTreeNode;
begin begin
CurProcVar:=nil; CurProcVar:=nil;
AVLNode:=VarTree.FindKey(VarNode,@CompareNodeWithExtractedProcVariable); AVLNode:=VarTree.FindKey(VarNode, TListSortCompare(@CompareNodeWithExtractedProcVariable));
if AVLNode=nil then begin if AVLNode=nil then begin
Result:=false; Result:=false;
end else begin end else begin

View File

@ -1757,8 +1757,16 @@ function TLinkScanner.GuessMisplacedIfdefEndif(StartCursorPos: integer;
function ReadDirectiveType(const ASrc: string; function ReadDirectiveType(const ASrc: string;
AToken: TToken): TDirectiveType; 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 var
ASrcLen, p: integer; ASrcLen, p: integer;
n: Integer;
begin begin
Result:=dtUnknown; Result:=dtUnknown;
ASrcLen:=length(ASrc); ASrcLen:=length(ASrc);
@ -1767,18 +1775,14 @@ function TLinkScanner.GuessMisplacedIfdefEndif(StartCursorPos: integer;
begin begin
// compiler directive // compiler directive
inc(p); inc(p);
if CompareIdentifiers(@ASrc[p],'IFDEF')=0 then for n := Low(DIR_TXT) to High(DIR_TXT) do
Result:=dtIfDef begin
else if CompareIdentifiers(@ASrc[p],'IFNDEF')=0 then if CompareIdentifiers(@ASrc[p], DIR_TXT[n]) = 0
Result:=dtIfNDef then begin
else if CompareIdentifiers(@ASrc[p],'IF')=0 then Result := DIR_RST[n];
Result:=dtIf Exit;
else if CompareIdentifiers(@ASrc[p],'IFOPT')=0 then end;
Result:=dtIfOpt end;
else if CompareIdentifiers(@ASrc[p],'ELSE')=0 then
Result:=dtElse
else if CompareIdentifiers(@ASrc[p],'ENDIF')=0 then
Result:=dtEndif;
end; end;
end; end;

View File

@ -2153,7 +2153,7 @@ begin
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier(false) then begin
CurIdentNode:= CurIdentNode:=
IdentTree.FindKey(@Src[CurPos.StartPos],@CompareIdentifiers); IdentTree.FindKey(@Src[CurPos.StartPos], TListSortCompare(@CompareIdentifiers));
if CurIdentNode<>nil then begin if CurIdentNode<>nil then begin
CurDiff:=CurPos.StartPos-CleanCursorPos; CurDiff:=CurPos.StartPos-CleanCursorPos;
if CurDiff<0 then CurDiff:=-CurDiff; if CurDiff<0 then CurDiff:=-CurDiff;
@ -2992,7 +2992,7 @@ begin
while ANode<>nil do begin while ANode<>nil do begin
if (ANode.Desc=ctnConstDefinition) then begin if (ANode.Desc=ctnConstDefinition) then begin
if IdentTree=nil then if IdentTree=nil then
IdentTree:=TAVLTree.Create(@BasicCodeTools.CompareIdentifiers); IdentTree:=TAVLTree.Create(TListSortCompare(@BasicCodeTools.CompareIdentifiers));
IdentTree.Add(@Src[ANode.StartPos]); IdentTree.Add(@Src[ANode.StartPos]);
end; end;
ANode:=ANode.NextBrother; ANode:=ANode.NextBrother;

View File

@ -427,7 +427,7 @@ var
begin begin
// create/clear tree // create/clear tree
if FClasses=nil then if FClasses=nil then
FClasses:=TAvgLvlTree.CreateObjectCompare(@CompareClasses) FClasses:=TAvgLvlTree.CreateObjectCompare(TObjectSortCompare(@CompareClasses))
else else
FClasses.Clear; FClasses.Clear;
// add class of ThePersistent // add class of ThePersistent

View File

@ -53,7 +53,7 @@ type
TOnPersistentAdded = procedure(Sender: TObject; APersistent: TPersistent; TOnPersistentAdded = procedure(Sender: TObject; APersistent: TPersistent;
ComponentClass: TRegisteredComponent) of object; ComponentClass: TRegisteredComponent) of object;
TOnPasteComponent = procedure(Sender: TObject; LookupRoot: TComponent; TOnPasteComponent = procedure(Sender: TObject; LookupRoot: TComponent;
TxtCompStream: TStream; Parent: TComponent; TxtCompStream: TStream; Parent: TWinControl;
var NewComponent: TComponent) of object; var NewComponent: TComponent) of object;
TOnRemovePersistent = procedure(Sender: TObject; APersistent: TPersistent) TOnRemovePersistent = procedure(Sender: TObject; APersistent: TPersistent)
of object; of object;
@ -175,10 +175,10 @@ type
Procedure NudgeSize(DiffX, DiffY: Integer); Procedure NudgeSize(DiffX, DiffY: Integer);
procedure SelectParentOfSelection; procedure SelectParentOfSelection;
function DoCopySelectionToClipboard: boolean; function DoCopySelectionToClipboard: boolean;
function GetPasteParent: TComponent; function GetPasteParent: TWinControl;
function DoPasteSelectionFromClipboard(PasteFlags: TComponentPasteSelectionFlags function DoPasteSelectionFromClipboard(PasteFlags: TComponentPasteSelectionFlags
): boolean; ): boolean;
function DoInsertFromStream(s: TStream; PasteParent: TComponent; function DoInsertFromStream(s: TStream; PasteParent: TWinControl;
PasteFlags: TComponentPasteSelectionFlags): Boolean; PasteFlags: TComponentPasteSelectionFlags): Boolean;
procedure DoShowTabOrderEditor; procedure DoShowTabOrderEditor;
procedure DoShowChangeClassDialog; procedure DoShowChangeClassDialog;
@ -226,7 +226,7 @@ type
function PasteSelection(PasteFlags: TComponentPasteSelectionFlags): boolean; override; function PasteSelection(PasteFlags: TComponentPasteSelectionFlags): boolean; override;
function DeleteSelection: boolean; override; function DeleteSelection: boolean; override;
function CopySelectionToStream(AllComponentsStream: TStream): boolean; override; function CopySelectionToStream(AllComponentsStream: TStream): boolean; override;
function InsertFromStream(s: TStream; Parent: TComponent; function InsertFromStream(s: TStream; Parent: TWinControl;
PasteFlags: TComponentPasteSelectionFlags): Boolean; override; PasteFlags: TComponentPasteSelectionFlags): Boolean; override;
function InvokeComponentEditor(AComponent: TComponent; function InvokeComponentEditor(AComponent: TComponent;
MenuIndex: integer): boolean; override; MenuIndex: integer): boolean; override;
@ -517,7 +517,7 @@ begin
Result:=true; Result:=true;
end; end;
function TDesigner.InsertFromStream(s: TStream; Parent: TComponent; function TDesigner.InsertFromStream(s: TStream; Parent: TWinControl;
PasteFlags: TComponentPasteSelectionFlags): Boolean; PasteFlags: TComponentPasteSelectionFlags): Boolean;
begin begin
Result:=DoInsertFromStream(s,Parent,PasteFlags); Result:=DoInsertFromStream(s,Parent,PasteFlags);
@ -559,7 +559,7 @@ begin
Result:=true; Result:=true;
end; end;
function TDesigner.GetPasteParent: TComponent; function TDesigner.GetPasteParent: TWinControl;
var var
i: Integer; i: Integer;
begin begin
@ -602,7 +602,7 @@ begin
end; end;
function TDesigner.DoInsertFromStream(s: TStream; function TDesigner.DoInsertFromStream(s: TStream;
PasteParent: TComponent; PasteFlags: TComponentPasteSelectionFlags): Boolean; PasteParent: TWinControl; PasteFlags: TComponentPasteSelectionFlags): Boolean;
var var
AllComponentText: string; AllComponentText: string;
StartPos: Integer; StartPos: Integer;

View File

@ -136,7 +136,7 @@ type
procedure InsertFromTemplateClick(Sender: TObject); procedure InsertFromTemplateClick(Sender: TObject);
procedure SaveAsTemplateClick(Sender: TObject); procedure SaveAsTemplateClick(Sender: TObject);
procedure DeleteFromTemplateClick(Sender: TObject); procedure DeleteFromTemplateClick(Sender: TObject);
procedure OnComponentModified(Sender: TComponent); procedure OnComponentModified(Sender: TObject);
// Functions for editing menus // Functions for editing menus
function AddNewItemBefore(MenuItem: PDesignerMenuItem; Ident: string): PDesignerMenuItem; 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 ----------// // 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 var
Selection: TPersistentSelectionList; Selection: TPersistentSelectionList;
i: Integer; i: Integer;

View File

@ -149,7 +149,7 @@ each control that's dropped onto the form
): TIComponentInterface; override; ): TIComponentInterface; override;
Function FindComponent(AComponent: TComponent): TIComponentInterface; override; Function FindComponent(AComponent: TComponent): TIComponentInterface; override;
function SaveSelectionToStream(s: TStream): Boolean; override; function SaveSelectionToStream(s: TStream): Boolean; override;
function InsertFromStream(s: TStream; Parent: TComponent; function InsertFromStream(s: TStream; Parent: TWinControl;
Flags: TComponentPasteSelectionFlags): Boolean; override; Flags: TComponentPasteSelectionFlags): Boolean; override;
function ClearSelection: Boolean; override; function ClearSelection: Boolean; override;
function DeleteSelection: Boolean; override; function DeleteSelection: Boolean; override;
@ -881,7 +881,7 @@ begin
Result:=false; Result:=false;
end; end;
function TCustomFormEditor.InsertFromStream(s: TStream; Parent: TComponent; function TCustomFormEditor.InsertFromStream(s: TStream; Parent: TWinControl;
Flags: TComponentPasteSelectionFlags): Boolean; Flags: TComponentPasteSelectionFlags): Boolean;
var var
ADesigner: TIDesigner; ADesigner: TIDesigner;
@ -1521,9 +1521,9 @@ var
begin begin
IsDefined:=false; IsDefined:=false;
if FDefineProperties=nil then if FDefineProperties=nil then
FDefineProperties:=TAVLTree.Create(@CompareDefPropCacheItems); FDefineProperties:=TAVLTree.Create(TListSortCompare(@CompareDefPropCacheItems));
ANode:=FDefineProperties.FindKey(PChar(APersistentClassName), ANode:=FDefineProperties.FindKey(PChar(APersistentClassName),
@ComparePersClassNameAndDefPropCacheItem); TListSortCompare(@ComparePersClassNameAndDefPropCacheItem));
if ANode=nil then begin if ANode=nil then begin
// cache component class, try to retrieve the define properties // cache component class, try to retrieve the define properties
CacheItem:=TDefinePropertiesCacheItem.Create; CacheItem:=TDefinePropertiesCacheItem.Create;

View File

@ -74,7 +74,7 @@ end;
---------------------------------------------------------------------------} ---------------------------------------------------------------------------}
procedure SetPrimaryConfigPath(const NewValue: String); procedure SetPrimaryConfigPath(const NewValue: String);
begin begin
PrimaryConfigPath:=FExpand(NewValue); PrimaryConfigPath:=ExpandFileName{FExpand}(NewValue);
end; end;
{--------------------------------------------------------------------------- {---------------------------------------------------------------------------
@ -82,7 +82,7 @@ end;
---------------------------------------------------------------------------} ---------------------------------------------------------------------------}
procedure SetSecondaryConfigPath(const NewValue: String); procedure SetSecondaryConfigPath(const NewValue: String);
begin begin
SecondaryConfigPath:=FExpand(NewValue); SecondaryConfigPath:=ExpandFileName{FExpand}(NewValue);
end; end;
{--------------------------------------------------------------------------- {---------------------------------------------------------------------------
@ -193,7 +193,7 @@ end;
---------------------------------------------------------------------------} ---------------------------------------------------------------------------}
procedure InternalInit; procedure InternalInit;
begin begin
PrimaryConfigPath:=FExpand('~/.lazarus'); PrimaryConfigPath:=ExpandFileName{FExpand}('~/.lazarus');
SecondaryConfigPath:='/etc/lazarus'; SecondaryConfigPath:='/etc/lazarus';
end; end;

View File

@ -1036,8 +1036,8 @@ begin
//writeln('TMainIDEBase.DoCheckUnitPathForAmbigiousPascalFiles A UnitPath="',UnitPath,'" Ext=',CompiledExt,' Context=',ContextDescription); //writeln('TMainIDEBase.DoCheckUnitPathForAmbigiousPascalFiles A UnitPath="',UnitPath,'" Ext=',CompiledExt,' Context=',ContextDescription);
SourceUnitTree:=TAVLTree.Create(@CompareUnitFiles); SourceUnitTree:=TAVLTree.Create(TListSortCompare(@CompareUnitFiles));
CompiledUnitTree:=TAVLTree.Create(@CompareUnitFiles); CompiledUnitTree:=TAVLTree.Create(TListSortCompare(@CompareUnitFiles));
FileInfoNeedClose:=false; FileInfoNeedClose:=false;
try try
// collect all units (.pas, .pp, compiled units) // collect all units (.pas, .pp, compiled units)
@ -1067,7 +1067,7 @@ begin
CurFilename:=CurDir+FileInfo.Name; CurFilename:=CurDir+FileInfo.Name;
// check if unit already found // check if unit already found
ANode:=CurUnitTree.FindKey(PChar(CurUnitName), ANode:=CurUnitTree.FindKey(PChar(CurUnitName),
@CompareUnitNameAndUnitFile); TListSortCompare(@CompareUnitNameAndUnitFile));
if ANode<>nil then begin if ANode<>nil then begin
// pascal unit exists twice // pascal unit exists twice
Result:=MessageDlg('Ambigious unit found', Result:=MessageDlg('Ambigious unit found',

View File

@ -52,7 +52,7 @@ type
function PasteSelection(Flags: TComponentPasteSelectionFlags): boolean; virtual; abstract; function PasteSelection(Flags: TComponentPasteSelectionFlags): boolean; virtual; abstract;
function DeleteSelection: boolean; virtual; abstract; function DeleteSelection: boolean; virtual; abstract;
function CopySelectionToStream(s: TStream): boolean; virtual; abstract; function CopySelectionToStream(s: TStream): boolean; virtual; abstract;
function InsertFromStream(s: TStream; Parent: TComponent; function InsertFromStream(s: TStream; Parent: TWinControl;
Flags: TComponentPasteSelectionFlags Flags: TComponentPasteSelectionFlags
): Boolean; virtual; abstract; ): Boolean; virtual; abstract;
function InvokeComponentEditor(AComponent: TComponent; function InvokeComponentEditor(AComponent: TComponent;

View File

@ -74,13 +74,13 @@ type
function CompareComponentCandidates( function CompareComponentCandidates(
Candidate1, Candidate2: TComponentCandidate): integer; Candidate1, Candidate2: TComponentCandidate): integer;
begin begin
Result:=ComparePointers(Candidate1.APersistent,Candidate2.APersistent); Result := ComparePointers(Candidate1.APersistent, Candidate2.APersistent);
end; end;
function ComparePersistentWithComponentCandidate( function ComparePersistentWithComponentCandidate(
APersistent: TPersistent; Candidate: TComponentCandidate): integer; APersistent: TPersistent; Candidate: TComponentCandidate): integer;
begin begin
Result:=ComparePointers(APersistent,Candidate.APersistent); Result := ComparePointers(APersistent, Candidate.APersistent);
end; end;
{ TComponentTreeView } { TComponentTreeView }
@ -180,7 +180,7 @@ var
CurControl:=AControl.Controls[i]; CurControl:=AControl.Controls[i];
if CurControl.Owner<>AControl.Owner then continue; if CurControl.Owner<>AControl.Owner then continue;
AVLNode:=Candidates.FindKey(CurControl, AVLNode:=Candidates.FindKey(CurControl,
@ComparePersistentWithComponentCandidate); TListSortCompare(@ComparePersistentWithComponentCandidate));
Candidate:=TComponentCandidate(AVLNode.Data); Candidate:=TComponentCandidate(AVLNode.Data);
if Candidate.Added then continue; if Candidate.Added then continue;
Candidate.Added:=true; Candidate.Added:=true;
@ -207,7 +207,7 @@ var
CurMenuItem:=AMenuItem.Items[i]; CurMenuItem:=AMenuItem.Items[i];
if CurMenuItem.Owner<>RootComponent then continue; if CurMenuItem.Owner<>RootComponent then continue;
AVLNode:=Candidates.FindKey(CurMenuItem, AVLNode:=Candidates.FindKey(CurMenuItem,
@ComparePersistentWithComponentCandidate); TListSortCompare(@ComparePersistentWithComponentCandidate));
Candidate:=TComponentCandidate(AVLNode.Data); Candidate:=TComponentCandidate(AVLNode.Data);
if Candidate.Added then continue; if Candidate.Added then continue;
Candidate.Added:=true; Candidate.Added:=true;
@ -239,7 +239,7 @@ begin
RootObject:=PropertyEditorHook.LookupRoot; RootObject:=PropertyEditorHook.LookupRoot;
if RootObject<>nil then begin if RootObject<>nil then begin
Candidates:=TAvgLvlTree.Create(@CompareComponentCandidates); Candidates:=TAvgLvlTree.Create(TListSortCompare(@CompareComponentCandidates));
try try
// first add the lookup root // first add the lookup root
RootNode:=Items.Add(nil,CreateNodeCaption(RootObject)); RootNode:=Items.Add(nil,CreateNodeCaption(RootObject));
@ -273,7 +273,7 @@ begin
for i:=0 to RootComponent.ComponentCount-1 do begin for i:=0 to RootComponent.ComponentCount-1 do begin
AComponent:=RootComponent.Components[i]; AComponent:=RootComponent.Components[i];
AVLNode:=Candidates.FindKey(AComponent, AVLNode:=Candidates.FindKey(AComponent,
@ComparePersistentWithComponentCandidate); TListSortCompare(@ComparePersistentWithComponentCandidate));
Candidate:=TComponentCandidate(AVLNode.Data); Candidate:=TComponentCandidate(AVLNode.Data);
if Candidate.Added then if Candidate.Added then
continue; continue;

View File

@ -109,7 +109,7 @@ type
// selection // selection
function SaveSelectionToStream(s: TStream): Boolean; virtual; abstract; function SaveSelectionToStream(s: TStream): Boolean; virtual; abstract;
function InsertFromStream(s: TStream; Parent: TComponent; function InsertFromStream(s: TStream; Parent: TWinControl;
Flags: TComponentPasteSelectionFlags Flags: TComponentPasteSelectionFlags
): Boolean; virtual; abstract; ): Boolean; virtual; abstract;
function ClearSelection: Boolean; virtual; abstract; function ClearSelection: Boolean; virtual; abstract;

View File

@ -2575,7 +2575,7 @@ begin
try try
Cnt:=FileCount; Cnt:=FileCount;
for i:=0 to Cnt-1 do NewList.Add(FFiles[i]); for i:=0 to Cnt-1 do NewList.Add(FFiles[i]);
NewList.Sort(@ComparePkgFilesAlphabetically); NewList.Sort(TListSortCompare(@ComparePkgFilesAlphabetically));
i:=Cnt-1; i:=Cnt-1;
while (i>=0) and (NewList[i]=FFiles[i]) do dec(i); while (i>=0) and (NewList[i]=FFiles[i]) do dec(i);
if i<0 then exit; if i<0 then exit;
@ -3525,9 +3525,9 @@ end;
{ TPkgPairTree } { TPkgPairTree }
function ComparePkgPairs(Pair1, Pair2: TPkgPair): integer; function ComparePkgPairs(Pair1, Pair2: Pointer): integer;
begin begin
Result:=Pair1.Compare(Pair2); Result:=TPkgPair(Pair1).Compare(TPkgPair(Pair2));
end; end;
constructor TPkgPairTree.Create; constructor TPkgPairTree.Create;
@ -3604,11 +3604,6 @@ end;
{ TPkgUnitsTree } { TPkgUnitsTree }
function ComparePkgFilesUnitname(PkgFile1, PkgFile2: TPkgFile): integer;
begin
Result:=AnsiCompareText(PkgFile1.UnitName,PkgFile2.UnitName);
end;
function TPkgUnitsTree.FindNodeWithUnitName(const UnitName: string function TPkgUnitsTree.FindNodeWithUnitName(const UnitName: string
): TAVLTreeNode; ): TAVLTreeNode;
var var
@ -3640,6 +3635,13 @@ begin
Result:=TPkgFile(ANode.Data); Result:=TPkgFile(ANode.Data);
end; end;
function ComparePkgFilesUnitname(PkgFile1, PkgFile2: Pointer): integer;
begin
Result := AnsiCompareText(
TPkgFile(PkgFile1).UnitName,
TPkgFile(PkgFile2).UnitName);
end;
constructor TPkgUnitsTree.Create(ThePackage: TLazPackage); constructor TPkgUnitsTree.Create(ThePackage: TLazPackage);
begin begin
fLazPackage:=ThePackage; fLazPackage:=ThePackage;

View File

@ -1540,9 +1540,9 @@ var
begin begin
// for first time: create PackageTreeOfUnitTrees // for first time: create PackageTreeOfUnitTrees
if PackageTreeOfUnitTrees=nil then if PackageTreeOfUnitTrees=nil then
PackageTreeOfUnitTrees:=TAVLTree.Create(@CompareUnitsTree); PackageTreeOfUnitTrees:=TAVLTree.Create(TListSortCompare(@CompareUnitsTree));
// search UnitsTree for package // search UnitsTree for package
ANode:=PackageTreeOfUnitTrees.FindKey(Pkg,@ComparePackageWithUnitsTree); ANode:=PackageTreeOfUnitTrees.FindKey(Pkg, TListSortCompare(@ComparePackageWithUnitsTree));
if ANode<>nil then begin if ANode<>nil then begin
Result:=TPkgUnitsTree(ANode.Data); Result:=TPkgUnitsTree(ANode.Data);
exit; exit;