浏览代码

* Applied patch from Graeme to fix link resolving (17276)

git-svn-id: trunk@15910 -
michael 15 年之前
父节点
当前提交
bd7d55d592
共有 2 个文件被更改,包括 41 次插入27 次删除
  1. 27 13
      utils/fpdoc/dglobals.pp
  2. 14 14
      utils/fpdoc/fpdoc.lpi

+ 27 - 13
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;

+ 14 - 14
utils/fpdoc/fpdoc.lpi

@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <CONFIG>
   <ProjectOptions>
-    <Version Value="7"/>
+    <Version Value="9"/>
     <General>
       <Flags>
         <SaveClosedFiles Value="False"/>
@@ -13,10 +13,9 @@
       </Flags>
       <SessionStorage Value="InProjectDir"/>
       <MainUnit Value="0"/>
-      <TargetFileExt Value=""/>
     </General>
     <VersionInfo>
-      <ProjectVersion Value=""/>
+      <StringTable ProductVersion=""/>
     </VersionInfo>
     <PublishOptions>
       <Version Value="2"/>
@@ -62,34 +61,35 @@
         <UnitName Value="dw_HTML"/>
       </Unit5>
       <Unit6>
-        <Filename Value="dw_ipf.pp"/>
+        <Filename Value="dw_man.pp"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="dw_IPF"/>
+        <UnitName Value="dw_man"/>
       </Unit6>
       <Unit7>
-        <Filename Value="dw_man.pp"/>
+        <Filename Value="dw_linrtf.pp"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="dw_man"/>
+        <UnitName Value="dw_LinRTF"/>
       </Unit7>
       <Unit8>
-        <Filename Value="dw_linrtf.pp"/>
+        <Filename Value="dw_txt.pp"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="dw_LinRTF"/>
+        <UnitName Value="dw_txt"/>
       </Unit8>
       <Unit9>
-        <Filename Value="dw_txt.pp"/>
+        <Filename Value="dglobals.pp"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="dw_txt"/>
+        <UnitName Value="dGlobals"/>
       </Unit9>
       <Unit10>
-        <Filename Value="dglobals.pp"/>
+        <Filename Value="dw_ipflin.pas"/>
         <IsPartOfProject Value="True"/>
-        <UnitName Value="dGlobals"/>
+        <UnitName Value="dw_ipflin"/>
       </Unit10>
     </Units>
   </ProjectOptions>
   <CompilerOptions>
-    <Version Value="8"/>
+    <Version Value="9"/>
+    </Parsing>
     <Other>
       <CompilerPath Value="$(CompPath)"/>
     </Other>