From bd7d55d5921620411ae188dcc87dfa0cd66de13c Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 26 Aug 2010 14:40:20 +0000 Subject: [PATCH] * Applied patch from Graeme to fix link resolving (17276) git-svn-id: trunk@15910 - --- utils/fpdoc/dglobals.pp | 40 +++++++++++++++++++++++++++------------- utils/fpdoc/fpdoc.lpi | 30 +++++++++++++++--------------- 2 files changed, 42 insertions(+), 28 deletions(-) diff --git a/utils/fpdoc/dglobals.pp b/utils/fpdoc/dglobals.pp index 78f214ec49..d8d7ded299 100644 --- a/utils/fpdoc/dglobals.pp +++ b/utils/fpdoc/dglobals.pp @@ -1071,8 +1071,17 @@ var i: Integer; ThisPackage: TLinkNode; UnitList: TList; + + function CanWeExit(AResult: string): boolean; + var + s: string; + begin + s := StringReplace(Lowercase(ALinkDest), '.', '_', [rfReplaceAll]); + Result := pos(s, AResult) > 0; + end; + begin -//WriteLn('ResolveLink(', ALinkDest, ')... '); +//system.WriteLn('ResolveLink(', AModule.Name, ' - ', ALinkDest, ')... '); if Length(ALinkDest) = 0 then begin SetLength(Result, 0); @@ -1083,13 +1092,18 @@ begin Result := FindAbsoluteLink(ALinkDest) else begin - Result := ResolveLink(AModule, amodule.packagename + '.' + ALinkDest); - if Length(Result) > 0 then - exit; - - Result := ResolveLink(AModule, AModule.PathName + '.' + ALinkDest); - if Length(Result) > 0 then - exit; + if Pos(AModule.Name, ALinkDest) = 1 then + begin + Result := ResolveLink(AModule, amodule.packagename + '.' + ALinkDest); + if CanWeExit(Result) then + Exit; + end + else + begin + Result := ResolveLink(AModule, AModule.PathName + '.' + ALinkDest); + if CanWeExit(Result) then + Exit; + end; { Try all packages } SetLength(Result, 0); @@ -1097,12 +1111,12 @@ begin while Assigned(ThisPackage) do begin Result := ResolveLink(AModule, ThisPackage.Name + '.' + ALinkDest); - if Length(Result) > 0 then - exit; + if CanWeExit(Result) then + Exit; ThisPackage := ThisPackage.NextSibling; end; - if Length(Result) = 0 then + if not CanWeExit(Result) then begin { Okay, then we have to try all imported units of the current module } UnitList := AModule.InterfaceSection.UsesList; @@ -1114,8 +1128,8 @@ begin begin Result := ResolveLink(AModule, ThisPackage.Name + '.' + TPasType(UnitList[i]).Name + '.' + ALinkDest); - if Length(Result) > 0 then - exit; + if CanWeExit(Result) then + Exit; ThisPackage := ThisPackage.NextSibling; end; end; diff --git a/utils/fpdoc/fpdoc.lpi b/utils/fpdoc/fpdoc.lpi index 5453a7fbff..3d3c830796 100644 --- a/utils/fpdoc/fpdoc.lpi +++ b/utils/fpdoc/fpdoc.lpi @@ -1,7 +1,7 @@ - + @@ -13,10 +13,9 @@ - - + @@ -62,34 +61,35 @@ - - - - - - - + + - - + + - - + + + + + + + - + +