View Issue Details

IDProjectCategoryView StatusLast Update
0038153FPCUtilitiespublic2021-01-22 15:55
ReporterAndrey Sobol Assigned ToMarco van de Voort  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Platformi386OSWindows 
Product Version3.2.0 
Summary0038153: hh.exe is crashed with running rtl.chm
DescriptionSee next field.
Steps To ReproducePrepare
1. Set hh.exe for .chm files as default viewer.
2. Double click on rtl.chm and run hh.exe
3. Go ro index tab.
4. And then do click by mouse the default opened document at right panel.
5. Close hh.exe

Second start
1. Double click on rtl.chm and run hh.exe (You are on index page and active field is the editbox.
2. Do nothing else... type on keybord for example a letter T.
3. hh.exe waits and then is closed.
TagsNo tags attached.
Fixed in Revision47915
FPCOldBugId
FPCTarget-
Attached Files

Activities

Marco van de Voort

2020-11-30 18:13

manager   ~0127270

I tried starting rtl.chm twice with

hh rtl.chm

but couldn't reproduce. Anyway, even I could, it is pretty hard to fix bugs without knowing what is wrong. Reproducing in the CHM gui doesn't really contribute much.

Andrey Sobol

2020-12-01 10:24

reporter   ~0127291

It is says only about that our CHMs have internal structure error.
I am going to dig this later.

wp

2020-12-01 10:44

reporter   ~0127292

Cannot confirm either: when pressing the key 't' hh.exe nicely jumps to the first occurence of an index item beginning with 't' and does not close.

Which rtl.chm are you using? I am using the one which comes with Laz 2.0.10/fpc 3.2.0; I can remember that there were issues with the index earlier.

Andrey Sobol

2020-12-01 13:26

reporter   ~0127297

I also use this rtl.chm. But you have to exactly reproduce secuence.

wp

2020-12-01 16:53

reporter   ~0127301

I think I did...

> 4. And then do click by mouse the default opened document at right panel.

Here you mean that I should click somewhere in the document of the right oanel?

Andrey Sobol

2020-12-01 17:02

reporter   ~0127302

> Here you mean that I should click somewhere in the document of the right oanel?
yes.

wp

2020-12-01 17:09

reporter   ~0127303

Then I did it correctly. --> Cannot reproduce the bug.

Marco van de Voort

2020-12-13 23:40

manager   ~0127600

> It is says only about that our CHMs have internal structure error.

This is known btw, noticable if you do experiments with merged CHMs.

Andrey Sobol

2020-12-14 00:04

reporter   ~0127601

Last edited: 2020-12-14 00:09

View 2 revisions

I test that without combining. I think that occur because hh makes indexes on first start of new .chm, I often open a new generated. And errors into our indexes exists also. I am going to issue patch tomorrow.

Andrey Sobol

2020-12-14 14:18

reporter   ~0127608

Last edited: 2020-12-14 14:24

View 3 revisions

I`ve done some fpdoc improvements and fixes.
The patch, description file, images and .chms are attached.

Attached .chms are here
https://drive.google.com/file/d/1sSF0bny9oQ-K_thCnygYjTZEwrC7mW0q/view?usp=sharing
patch_fpdoc_04.patch (19,784 bytes)   
Index: dglobals.pp
===================================================================
--- dglobals.pp	(revision 47743)
+++ dglobals.pp	(working copy)
@@ -23,7 +23,7 @@
 
 interface
 
-uses Classes, DOM, PasTree, PParser, uriparser;
+uses Classes, DOM, PasTree, PParser, uriparser, SysUtils;
 
 Const
   CacheSize = 20;
@@ -343,9 +343,9 @@
     constructor Create;
     destructor Destroy; override;
     procedure SetPackageName(const APackageName: String);
-    // process the import objects from external .xct file
+    // The process importing of objects from external .xct file
     procedure ReadContentFile(const AFilename, ALinkPrefix: String);
-    // creation of an own .xct output file
+    // Creation of an own .xct output file
     procedure WriteContentFile(const AFilename: String);
 
     function CreateElement(AClass: TPTreeElement; const AName: String;
@@ -385,6 +385,7 @@
 
 
 procedure TranslateDocStrings(const Lang: String);
+function DumpExceptionCallStack(E: Exception):String;
 
 Function IsLinkNode(Node : TDomNode) : Boolean;
 Function IsExampleNode(Example : TDomNode) : Boolean;
@@ -395,7 +396,7 @@
 
 implementation
 
-uses SysUtils, Gettext, XMLRead;
+uses Gettext, XMLRead;
 
 const
   AbsoluteLinkPrefixes : array[0..2] of string = ('/', 'http://', 'ms-its:');
@@ -1133,7 +1134,7 @@
             begin
             for k:=0 to ClassLikeDecl.Interfaces.count-1 do
               begin
-                write(contentfile,',',CheckImplicitLink(TPasClassType(ClassLikeDecl.Interfaces[k]).PathName));
+                write(contentfile,',',CheckImplicitLink(TPasType(ClassLikeDecl.Interfaces[k]).PathName));
                 if TPasElement(ClassLikeDecl.Interfaces[k]) is TPasAliasType then
                   begin
                     alias:= TPasAliasType(ClassLikeDecl.Interfaces[k]);
@@ -1757,6 +1758,23 @@
     end;
 end;
 
+function DumpExceptionCallStack(E: Exception):String;
+var
+  I: Integer;
+  Frames: PPointer;
+begin
+  Result := 'Program exception! ' + LineEnding +
+    'Stacktrace:' + LineEnding + LineEnding;
+  if E <> nil then begin
+    Result := Result + 'Exception class: ' + E.ClassName + LineEnding +
+    'Message: ' + E.Message + LineEnding;
+  end;
+  Result := Result + BackTraceStrFunc(ExceptAddr);
+  Frames := ExceptFrames;
+  for I := 0 to ExceptFrameCount - 1 do
+    Result := Result + LineEnding + BackTraceStrFunc(Frames[I]);
+end;
+
 initialization
   LEOL:=Length(LineEnding);
 end.
Index: dw_html.pp
===================================================================
--- dw_html.pp	(revision 47743)
+++ dw_html.pp	(working copy)
@@ -19,7 +19,7 @@
 {$WARN 5024 off : Parameter "$1" not used}
 interface
 
-uses Classes, DOM, DOM_HTML, dGlobals, PasTree, dWriter, ChmWriter, chmtypes;
+uses Classes, DOM, DOM_HTML, dGlobals, PasTree, dWriter, ChmWriter, chmtypes, chmsitemap;
 
 const
   // Subpage indices for modules
@@ -49,10 +49,13 @@
     procedure AllocFilename(AElement: TPasElement; ASubindex: Integer); virtual;
     function GetFilename(AElement: TPasElement;
       ASubindex: Integer): String; virtual; abstract;
+    function GetModuleListFilename(AElementList: TFPList): String; virtual; abstract;
     function GetRelativePathToTop(AElement: TPasElement): String; virtual;
     function GetCSSFilename(ARelativeTo: TPasElement): DOMString; virtual;
   end;
 
+  { TLongNameFileAllocator }
+
   TLongNameFileAllocator = class(TFileAllocator)
   private
     FExtension: String;
@@ -59,6 +62,7 @@
   public
     constructor Create(const AExtension: String);
     function GetFilename(AElement: TPasElement; ASubindex: Integer): String; override;
+    function GetModuleListFilename(AElementList: TFPList): String; override;
     function GetRelativePathToTop(AElement: TPasElement): String; override;
     property Extension: String read FExtension;
   end;
@@ -255,7 +259,6 @@
     // Start producing html complete package documentation
     procedure WriteHTMLPages; virtual;
     procedure WriteXHTMLPages;
-    function  ModuleForElement(AnElement:TPasElement):TPasModule;
 
     Function InterPretOption(Const Cmd,Arg : String) : boolean; override;
     Procedure WriteDoc; override;
@@ -281,8 +284,7 @@
 
 implementation
 
-uses SysUtils, XMLRead, HTMWrite, sh_pas, fpdocclasstree,
-  chmsitemap;
+uses SysUtils, XMLRead, HTMWrite, sh_pas, fpdocclasstree;
 
 {$i css.inc}
 {$i plusimage.inc}
@@ -311,8 +313,6 @@
   Result := Utf8Decode(GetRelativePathToTop(ARelativeTo)) + 'fpdoc.css';
 end;
 
-
-
 constructor TLongNameFileAllocator.Create(const AExtension: String);
 begin
   inherited Create;
@@ -333,12 +333,12 @@
     Result := 'index';
     excl := True;
   end
-  else if AElement.ClassType = TPasModule then
+     else if AElement.ClassType = TPasModule then
   begin
     Result := LowerCase(AElement.Name) + PathDelim + 'index';
     excl := True;
   end
-  else
+     else
   begin
     if AElement is TPasOperator then
     begin
@@ -373,9 +373,11 @@
       excl := (ASubindex > 0);
     end;
     // searching for TPasModule - it is on the 2nd level
-    if Assigned(AElement.Parent) then
-      while Assigned(AElement.Parent.Parent) do
-        AElement := AElement.Parent;
+    if AElement.GetModule <> nil then
+      AElement := AElement.GetModule // TODO: handle GetElementModule() = nil ?
+    else
+      Raise EFPDocWriterError.Create(
+      'TLongNameFileAllocator error: Unresolved module name for element: ' +AElement.PathName);
     // cut off Package Name
     Result := Copy(Result, Length(AElement.Parent.Name) + 2, MaxInt);
     // to skip dots in unit name
@@ -401,6 +403,38 @@
 //  Writeln('Result filename : ',Result);
 end;
 
+function TLongNameFileAllocator.GetModuleListFilename(AElementList: TFPList): String;
+var
+  AEl: TPasElement;
+begin
+  Result:='';
+  if AElementList.Count > 0 then
+  begin
+    AEl:= TPasElement(AElementList.Items[0]);
+    if not Assigned(AEl) then exit;
+    if Assigned(AEl.GetModule) then
+    begin // the lists from module  -> /module/index-idx.html
+      Result:=LowerCase(AEl.GetModule.Name);
+      // can get from engine find module
+      if (AEl is TPasClassType) then
+        Result :=  result + PathDelim + 'index-' + IntToStr(ClassesSubindex)
+      else if (AEl is TPasConst) then // TPasConst = class(TPasVariable)
+        Result :=  result + PathDelim + 'index-' + IntToStr(ConstsSubindex)
+      else if (AEl is TPasVariable) then
+        Result :=  result + PathDelim + 'index-' + IntToStr(VarsSubindex)
+      else if (AEl is TPasProcedure) or (AEl is TPasOverloadedProc) then // procedure and functions
+        Result :=  result + PathDelim + 'index-' + IntToStr(ProcsSubindex)
+      else
+      begin
+        Result:= 'unresolved type : ' + AEl.ElementTypeName;
+        WriteLn('Warning: Chm module index unresolved type : ', ael.PathName);
+      end;
+    end;
+    if Result = '' then exit;
+    Result := Result + Extension;
+  end;
+end;
+
 function TLongNameFileAllocator.GetRelativePathToTop(AElement: TPasElement): String;
 begin
   if (AElement.ClassType=TPasPackage) then
@@ -836,16 +870,6 @@
   end;
 end;
 
-function  THTMLWriter.ModuleForElement(AnElement:TPasElement):TPasModule;
-
-begin
-  result:=TPasModule(AnElement);
-  while assigned(result) and not (result is TPasModule) do 
-        result:=TPasModule(result.parent);
-  if not (result is TPasModule) then
-   result:=nil;
-end;
-
 procedure THTMLWriter.CreateCSSFile;
 
 Var
@@ -1693,7 +1717,7 @@
     end else
     begin
       Result := nil;
-      AppendText(Parent, Element.Name);
+      AppendText(Parent, Element.Name); // unresolved items
     end;
   end else
   begin
@@ -2296,7 +2320,7 @@
         else
           AppendText(NewEl,El['id']);
        l:=El['id'];
-       DescrEl := Engine.FindShortDescr(ModuleForElement(AElement),UTF8Encode(L));
+       DescrEl := Engine.FindShortDescr(AElement.GetModule,UTF8Encode(L));
        if Assigned(DescrEl) then
          begin
          AppendNbSp(CreatePara(CreateTD(TREl)), 2);
@@ -2496,7 +2520,7 @@
       if (PE<>Nil) then
         begin
         AppendHyperLink(CurOutputNode,PE);
-        PM:=ModuleForElement(PE);
+        PM:=PE.GetModule();
         if (PM<>Nil) then
           begin
           AppendText(CurOutputNode,' (');
@@ -3159,7 +3183,7 @@
   i: Integer;
   s: String;
   t : TPasType;
-  ah,ol,wt,ct,wc,cc  : boolean;
+  ah,ol,wt,ct,wc,cc : boolean;
   isRecord : Boolean;
 
 begin
@@ -3174,6 +3198,8 @@
       begin
       Member := TPasElement(Members[i]);
       MVisibility:=Member.Visibility;
+      cc:=(Member is TPasConst);
+      ct:=(Member is TPasType);
       ol:=(Member is TPasOverloadedProc);
       ah:=ol or ((Member is TPasProcedure) and (TPasProcedure(Member).ProcType.Args.Count > 0));
       if ol then
@@ -3180,24 +3206,16 @@
         Member:=TPasElement((Member as TPasOverloadedProc).Overloads[0]);
       if Not Engine.ShowElement(Member) then
         continue;
-      if (CurVisibility <> MVisibility) then
+      if (CurVisibility <> MVisibility) or (cc <> wc) or (ct <> wt) then
         begin
         CurVisibility := MVisibility;
+        wc:=cc;
+        wt:=ct;
         s:=VisibilityNames[MVisibility];
         AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), UTF8Decode(s));
+        if (ct) then AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), 'type');
+        if (cc) then AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), 'const');
         end;
-      ct:=(Member is TPasType);
-      if ct and (not wt) then
-        begin
-        AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), 'Type');
-        end;
-      wt:=ct;
-      cc:=(Member is TPasConst);
-      if cc and (not wc) then
-        begin
-        AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), 'Const');
-        end;
-      wc:=cc;
       TREl := CreateTR(TableEl);
       CodeEl := CreateCode(CreatePara(CreateTD_vtop(TREl)));
       AppendNbSp(CodeEl, 2);
@@ -3220,7 +3238,7 @@
         If Assigned(TPasConst(Member).VarType) then
           begin
           AppendSym(CodeEl, ' = ');
-          AppendTypeDecl(TPasType(Member),TableEl,CodeEl);
+          AppendTypeDecl(TPasType(TPasConst(Member).VarType),TableEl,CodeEl);
           end;
         AppendSym(CodeEl, ' = ');
         AppendText(CodeEl,UTF8Decode(TPasConst(Member).Expr.GetDeclaration(True)));
@@ -3272,7 +3290,7 @@
         else
           AppendText(CodeEl, UTF8Decode(Member.Name));
         AppendSym(CodeEl, ': ');
-        AppendHyperlink(CodeEl, TPasVariable(Member).VarType);
+        AppendType(CodeEl, TableEl, TPasVariable(Member).VarType,False);
         AppendSym(CodeEl, ';');
         end
       else
@@ -3492,6 +3510,7 @@
             AppendText(ParaEl, 'pt');
           visPublished:
             AppendText(ParaEl, 'pl');
+          else
         end;
         AppendNbSp(ParaEl, 1);
 
@@ -3560,6 +3579,7 @@
             AppendText(ParaEl, 'pt');
           visPublished:
             AppendText(ParaEl, 'pl');
+          else
         end;
         AppendNbSp(ParaEl, 1);
 
Index: dw_htmlchm.inc
===================================================================
--- dw_htmlchm.inc	(revision 47743)
+++ dw_htmlchm.inc	(working copy)
@@ -29,8 +29,13 @@
     FOtherFiles: String;
     procedure ProcessOptions;
     function ResolveLinkIDAbs(const Name: String; Level : Integer = 0): DOMString;
-    function RetrieveOtherFiles(const DataName: String; out PathInChm: String; out FileName: String; var Stream: TStream): Boolean;
+    function RetrieveOtherFiles(const DataName: String; out PathInChm: String;
+              out FileName: String; var Stream: TStream): Boolean;
     procedure LastFileAdded(Sender: TObject);
+    function FindAlphaItem(AItems: TChmSiteMapItems; AName: String): TChmSiteMapItem;
+    function GetAlphaItem(AItems: TChmSiteMapItems; AName: String): TChmSiteMapItem;
+    procedure MultiAlphaItem(AItems: TChmSiteMapItems; AName: String;
+            APasEl: TPasElement; Prefix:String);
     procedure GenerateTOC;
     procedure GenerateIndex;
   public
@@ -144,12 +149,8 @@
   DoLog('Finishing compressing...');
 end;
 
-function TOCSort(Item1, Item2: TChmSiteMapItem): Integer;
-begin
-  Result := CompareText(LowerCase(Item1.Text), LowerCase(Item2.Text));
-end;
-
-function GetAlphaItem(AItems: TChmSiteMapItems; AName: String): TChmSiteMapItem;
+function TCHMHTMLWriter.FindAlphaItem(AItems: TChmSiteMapItems; AName: String
+  ): TChmSiteMapItem;
 var
   x: Integer;
 begin
@@ -159,10 +160,44 @@
     if AItems.Item[x].Text = AName then
       Exit(AItems.Item[x]);
   end;
+end;
+
+function TCHMHTMLWriter.GetAlphaItem(AItems: TChmSiteMapItems; AName: String
+  ): TChmSiteMapItem;
+begin
+  Result := FindAlphaItem(AItems, AName);
+  if Result <> nil then Exit;
   Result := AItems.NewItem;
   Result.Text := AName;
 end;
-     
+
+procedure TCHMHTMLWriter.MultiAlphaItem(AItems: TChmSiteMapItems; AName: String;
+  APasEl: TPasElement; Prefix: String);
+var
+  AChmItem, AChmChld: TChmSiteMapItem;
+begin
+  AChmItem:= FindAlphaItem(AItems, AName);
+  if AChmItem = nil then
+  begin
+    // add new
+    AChmItem := AItems.NewItem;
+    AChmItem.Text :=  AName;
+    AChmItem.addLocal(FixHTMLpath(Allocator.GetFilename(APasEl, 0)));
+  end
+    else
+  begin
+    // add as child
+    AChmChld := AChmItem.Children.NewItem;
+    AChmChld.Text := Prefix + '.' + AName;
+    AChmChld.addLocal(FixHTMLpath(Allocator.GetFilename(APasEl, 0)));
+  end;
+end;
+
+function TOCSort(Item1, Item2: TChmSiteMapItem): Integer;
+begin
+  Result := CompareText(LowerCase(Item1.Text), LowerCase(Item2.Text));
+end;
+
 procedure TCHMHTMLWriter.GenerateTOC;
 var
   TOC: TChmSiteMap;
@@ -271,11 +306,12 @@
 
   fchm.AppendTOC(Stream);
   Stream.Free;
+  DoLog('Generating TOC done');
 end;
 
 type
   TClassMemberType = (cmtProcedure, cmtFunction, cmtConstructor, cmtDestructor,
-      cmtInterface, cmtProperty, cmtVariable, cmtUnknown);
+      cmtInterface, cmtProperty, cmtVariable, cmtOperator, cmtConstant, cmtUnknown);
   
 function ElementType(Element: TPasElement): TClassMemberType;
 var
@@ -282,9 +318,14 @@
   ETypeName: String;
 begin
   Result := cmtUnknown;
+  if not Assigned(Element) then Exit;
   ETypeName := Element.ElementTypeName;
-  //overloaded we don't care
-  if ETypeName[1] = 'o' then ETypeName := Copy(ETypeName, 11, Length(ETypeName));
+  if Length(ETypeName) = 0 then Exit;
+  // opearator
+  if ETypeName[2] = 'p' then Exit(cmtOperator);
+  if ETypeName[3] = 'n' then Exit(cmtConstant);
+  // overloaded we don't care
+  if ETypeName[1] = 'o' then ETypeName := Copy(ETypeName, 12, Length(ETypeName));
   
   if ETypeName[1] = 'f' then Exit(cmtFunction);
   if ETypeName[1] = 'c' then Exit(cmtConstructor);
@@ -293,7 +334,8 @@
   // the p's
   if ETypeName[4] = 'c' then Exit(cmtProcedure);
   if ETypeName[4] = 'p' then Exit(cmtProperty);
-  
+  // Unknown
+  // WriteLn(' Warning El name: '+ Element.Name+' path: '+Element.PathName+' TypeName: '+Element.ElementTypeName);
 end;
 
 procedure TCHMHTMLWriter.GenerateIndex;
@@ -307,7 +349,7 @@
   ParentElement: TPasElement;
   MemberItem: TChmSiteMapItem;
   Stream: TMemoryStream;
-  RedirectUrl,Urls: String;
+  RedirectUrl,Urls,SName: String;
 
 begin
   DoLog('Generating Index...');
@@ -348,7 +390,7 @@
 
           if(trim(RedirectUrl)<>'') and (RedirectUrl<>urls) then
             begin
-              writeln('Hint: Index Resolved:',urls,' to ',RedirectUrl);
+              //writeln('Hint: Index Resolved:',urls,' to ',RedirectUrl);
               urls:=RedirectUrl;
             end;
 
@@ -361,6 +403,8 @@
             cmtProperty    : TmpItem.Text := TmpElement.Name + ' property';
             cmtVariable    : TmpItem.Text := TmpElement.Name + ' variable';
             cmtInterface   : TmpItem.Text := TmpElement.Name + ' interface';
+            cmtOperator    : TmpItem.Text := TmpElement.Name + ' operator';
+            cmtConstant    : TmpItem.Text := TmpElement.Name + ' const';
             cmtUnknown     : TmpItem.Text := TmpElement.Name;
           end;
           TmpItem.addLocal(Urls);
@@ -381,18 +425,24 @@
       // routines
       for j := 0 to AModule.InterfaceSection.Functions.Count-1 do
       begin
-        ParentElement := TPasProcedureType(AModule.InterfaceSection.Functions[j]);
-        TmpItem := Index.Items.NewItem;
-        TmpItem.Text := ParentElement.Name + ' ' + ParentElement.ElementTypeName;
-        TmpItem.addLocal(FixHTMLpath(Allocator.GetFilename(ParentElement, 0)));
+        // routine name
+        ParentElement := TPasElement(AModule.InterfaceSection.Functions[j]);
+        case ElementType(ParentElement) of
+          cmtProcedure   : SName:= ' procedure';
+          cmtFunction    : SName:= ' function';
+          cmtOperator    : SName:= ' operator';
+          //cmtConstant    : SName:= ' const';
+          else             SName:= ' unknown'
+        end;
+        SName:= ParentElement.Name + ' ' + SName;
+        MultiAlphaItem(Index.Items, SName, ParentElement, AModule.Name);
       end;
       // consts
       for j := 0 to AModule.InterfaceSection.Consts.Count-1 do
       begin
         ParentElement := TPasElement(AModule.InterfaceSection.Consts[j]);
-        TmpItem := Index.Items.NewItem;
-        TmpItem.Text := ParentElement.Name;
-        TmpItem.addLocal(FixHTMLpath(Allocator.GetFilename(ParentElement, 0)));
+        SName:= ParentElement.Name + ' const';
+        MultiAlphaItem(Index.Items, SName, ParentElement, AModule.Name);
       end;
       // types
       for j := 0 to AModule.InterfaceSection.Types.Count-1 do
@@ -423,9 +473,8 @@
       for j := 0 to AModule.InterfaceSection.Variables.Count-1 do
       begin
         ParentElement := TPasElement(AModule.InterfaceSection.Variables[j]);
-        TmpItem := Index.Items.NewItem;
-        TmpItem.Text := ParentElement.Name + ' var';
-        TmpItem.addLocal(FixHTMLpath(Allocator.GetFilename(ParentElement, 0)));
+        SName:= ParentElement.Name + ' variable';
+        MultiAlphaItem(Index.Items, SName, ParentElement, AModule.Name);
       end;
       // declarations
       {
@@ -463,6 +512,7 @@
     FChm.AppendIndex(Stream);
     Stream.Free;
   end;
+  DoLog('Generating Index Done');
 end;
 
 procedure TCHMHTMLWriter.WriteHTMLPages;
@@ -537,9 +587,9 @@
       {$ifdef imagetest}  DoLog(' - not found'){$endif};
   end;
   FileStream.Free;
-
   FChm.Execute;
   FChm.Free;
+  DoLog('Collecting done');
   // we don't need to free FTempUncompressed
   // FTempUncompressed.Free;
   FOutChm.Free;
Index: fpdoc.pp
===================================================================
--- fpdoc.pp	(revision 47743)
+++ fpdoc.pp	(working copy)
@@ -53,8 +53,9 @@
     procedure OutputLog(Sender: TObject; const Msg: String);
     procedure ParseCommandLine;
     procedure ParseOption(const S: String);
-    Procedure Usage(AnExitCode : Byte);
-    Procedure DoRun; override;
+    procedure Usage(AnExitCode : Byte);
+    procedure ExceptProc(Sender: TObject; E: Exception);
+    procedure DoRun; override;
   Public
     Constructor Create(AOwner : TComponent); override;
     Destructor Destroy; override;
@@ -62,7 +63,7 @@
   end;
 
 
-Procedure TFPDocApplication.Usage(AnExitCode : Byte);
+procedure TFPDocApplication.Usage(AnExitCode: Byte);
 
 Var
   I,P : Integer;
@@ -146,6 +147,11 @@
   Halt(AnExitCode);
 end;
 
+procedure TFPDocApplication.ExceptProc(Sender: TObject; E: Exception);
+begin
+  OutputLog(Sender, DumpExceptionCallStack(E));
+end;
+
 destructor TFPDocApplication.Destroy;
 
 begin
@@ -425,6 +431,7 @@
   StopOnException:=true;
   FCreator:=TFPDocCreator.Create(Self);
   FCreator.OnLog:=@OutputLog;
+  OnException:= @ExceptProc;
 end;
 
 begin
patch_fpdoc_04.patch (19,784 bytes)   

Andrey Sobol

2020-12-14 14:20

reporter   ~0127609

the description
patch_fpdoc_description_04_en.txt (1,509 bytes)   
Patch Description.

Changes:
1. Index changes: Changed names for procedures, functions and variables. On add the same name procedure(func, var) is added new child node with module name as prefix. Before that was an adding repeated index items with same name for different URL at the same level of tree. That was a wrong index. I can change naming rule for Policy compliance.
2. Deleted the THTMLWriter.ModuleForElement() function because the same function is in TPasElement.getModule().
4. Fix the Exception TypeCast into THTMLWriter.CreateMemberDeclarations line 3250.
   new call AppendTypeDecl(TPasType(TPasConst(Member).VarType),TableEl,CodeEl);  
5. ReDone of showing a visibity for different class sections. For example the protected const <-> protected and back. Image attached.
6. Added support the DumpExceptionCallStack() on Exception for easy debug.
7. Fix the Exception TypeCast into dGlobal.pp
    write(contentfile,',',CheckImplicitLink(TPasType(ClassLikeDecl.Interfaces[k]).PathName)); line 1137.
8. Resolved the Variable Types showing for classes same as on the ClassMember page.  Image attached.
  
In a release build this errors was nor visible but they could damage indexes. 

Attached:
- new LCL.CHM as an example.
- images of indexes before and after.
- images of class members before and after.

Files:
https://drive.google.com/file/d/1sSF0bny9oQ-K_thCnygYjTZEwrC7mW0q/view?usp=sharing

I hope that you can allocate time to work with this patch.

Andrey Sobol.

Andrey Sobol

2020-12-29 21:33

reporter   ~0127915

Up
Here is patch for chm indexes... look at this please.

Andrey Sobol

2020-12-30 17:38

reporter   ~0127948

Last edited: 2020-12-30 17:56

View 2 revisions

Thisis patch (05) for new revision of the fpdoc with dedicated separately a dw_chm.pp
Description is same, images are same, the generated lcl.chm is here https://drive.google.com/file/d/1mXVNCHMUqXuykYXEyEJMJ374YQ7jl2DR/view?usp=sharing
For gets testing use keywords from images
patch_fpdoc_05.patch (17,117 bytes)   
Index: dglobals.pp
===================================================================
--- dglobals.pp	(revision 47893)
+++ dglobals.pp	(working copy)
@@ -23,7 +23,7 @@
 
 interface
 
-uses Classes, DOM, PasTree, PParser, uriparser;
+uses Classes, DOM, PasTree, PParser, uriparser, SysUtils;
 
 Const
   CacheSize = 20;
@@ -343,9 +343,9 @@
     constructor Create;
     destructor Destroy; override;
     procedure SetPackageName(const APackageName: String);
-    // process the import objects from external .xct file
+    // The process importing of objects from external .xct file
     procedure ReadContentFile(const AFilename, ALinkPrefix: String);
-    // creation of an own .xct output file
+    // Creation of an own .xct output file
     procedure WriteContentFile(const AFilename: String);
 
     function CreateElement(AClass: TPTreeElement; const AName: String;
@@ -385,6 +385,7 @@
 
 
 procedure TranslateDocStrings(const Lang: String);
+function DumpExceptionCallStack(E: Exception):String;
 
 Function IsLinkNode(Node : TDomNode) : Boolean;
 Function IsExampleNode(Example : TDomNode) : Boolean;
@@ -395,7 +396,7 @@
 
 implementation
 
-uses SysUtils, Gettext, XMLRead;
+uses Gettext, XMLRead;
 
 const
   AbsoluteLinkPrefixes : array[0..2] of string = ('/', 'http://', 'ms-its:');
@@ -1133,7 +1134,7 @@
             begin
             for k:=0 to ClassLikeDecl.Interfaces.count-1 do
               begin
-                write(contentfile,',',CheckImplicitLink(TPasClassType(ClassLikeDecl.Interfaces[k]).PathName));
+                write(contentfile,',',CheckImplicitLink(TPasType(ClassLikeDecl.Interfaces[k]).PathName));
                 if TPasElement(ClassLikeDecl.Interfaces[k]) is TPasAliasType then
                   begin
                     alias:= TPasAliasType(ClassLikeDecl.Interfaces[k]);
@@ -1757,6 +1758,23 @@
     end;
 end;
 
+function DumpExceptionCallStack(E: Exception):String;
+var
+  I: Integer;
+  Frames: PPointer;
+begin
+  Result := 'Program exception! ' + LineEnding +
+    'Stacktrace:' + LineEnding + LineEnding;
+  if E <> nil then begin
+    Result := Result + 'Exception class: ' + E.ClassName + LineEnding +
+    'Message: ' + E.Message + LineEnding;
+  end;
+  Result := Result + BackTraceStrFunc(ExceptAddr);
+  Frames := ExceptFrames;
+  for I := 0 to ExceptFrameCount - 1 do
+    Result := Result + LineEnding + BackTraceStrFunc(Frames[I]);
+end;
+
 initialization
   LEOL:=Length(LineEnding);
 end.
Index: dw_chm.pp
===================================================================
--- dw_chm.pp	(revision 47893)
+++ dw_chm.pp	(working copy)
@@ -3,7 +3,7 @@
 interface
 
 uses Classes, DOM, DOM_HTML,
-    dGlobals, PasTree, dwriter, dw_html, ChmWriter, chmtypes;
+    dGlobals, PasTree, dwriter, dw_html, chmwriter, chmtypes, chmsitemap;
 
 type
 
@@ -34,8 +34,13 @@
     FOtherFiles: String;
     procedure ProcessOptions;
     function ResolveLinkIDAbs(const Name: String; Level : Integer = 0): DOMString;
-    function RetrieveOtherFiles(const DataName: String; out PathInChm: String; out FileName: String; var Stream: TStream): Boolean;
+    function RetrieveOtherFiles(const DataName: String; out PathInChm: String;
+              out FileName: String; var Stream: TStream): Boolean;
     procedure LastFileAdded(Sender: TObject);
+    function FindAlphaItem(AItems: TChmSiteMapItems; AName: String): TChmSiteMapItem;
+    function GetAlphaItem(AItems: TChmSiteMapItems; AName: String): TChmSiteMapItem;
+    procedure MultiAlphaItem(AItems: TChmSiteMapItems; AName: String;
+            APasEl: TPasElement; Prefix:String);
     procedure GenerateTOC;
     procedure GenerateIndex;
   public
@@ -50,7 +55,7 @@
 
 implementation
 
-uses SysUtils, HTMWrite, chmsitemap;
+uses SysUtils, HTMWrite;
 
 { TFpDocChmWriter }
 
@@ -157,7 +162,8 @@
   Result := CompareText(LowerCase(Item1.Text), LowerCase(Item2.Text));
 end;
 
-function GetAlphaItem(AItems: TChmSiteMapItems; AName: String): TChmSiteMapItem;
+function TCHMHTMLWriter.FindAlphaItem(AItems: TChmSiteMapItems; AName: String
+  ): TChmSiteMapItem;
 var
   x: Integer;
 begin
@@ -167,10 +173,39 @@
     if AItems.Item[x].Text = AName then
       Exit(AItems.Item[x]);
   end;
+end;
+
+function TCHMHTMLWriter.GetAlphaItem(AItems: TChmSiteMapItems; AName: String
+  ): TChmSiteMapItem;
+begin
+  Result := FindAlphaItem(AItems, AName);
+  if Result <> nil then Exit;
   Result := AItems.NewItem;
   Result.Text := AName;
 end;
-     
+
+procedure TCHMHTMLWriter.MultiAlphaItem(AItems: TChmSiteMapItems; AName: String;
+  APasEl: TPasElement; Prefix: String);
+var
+  AChmItem, AChmChld: TChmSiteMapItem;
+begin
+  AChmItem:= FindAlphaItem(AItems, AName);
+  if AChmItem = nil then
+  begin
+    // add new
+    AChmItem := AItems.NewItem;
+    AChmItem.Text :=  AName;
+    AChmItem.addLocal(FixHTMLpath(Allocator.GetFilename(APasEl, 0)));
+  end
+    else
+  begin
+    // add as child
+    AChmChld := AChmItem.Children.NewItem;
+    AChmChld.Text := Prefix + '.' + AName;
+    AChmChld.addLocal(FixHTMLpath(Allocator.GetFilename(APasEl, 0)));
+  end;
+end;
+
 procedure TCHMHTMLWriter.GenerateTOC;
 var
   TOC: TChmSiteMap;
@@ -279,11 +314,12 @@
 
   fchm.AppendTOC(Stream);
   Stream.Free;
+  DoLog('Generating TOC done');
 end;
 
 type
   TClassMemberType = (cmtProcedure, cmtFunction, cmtConstructor, cmtDestructor,
-      cmtInterface, cmtProperty, cmtVariable, cmtUnknown);
+      cmtInterface, cmtProperty, cmtVariable, cmtOperator, cmtConstant, cmtUnknown);
   
 function ElementType(Element: TPasElement): TClassMemberType;
 var
@@ -290,9 +326,14 @@
   ETypeName: String;
 begin
   Result := cmtUnknown;
+  if not Assigned(Element) then Exit;
   ETypeName := Element.ElementTypeName;
-  //overloaded we don't care
-  if ETypeName[1] = 'o' then ETypeName := Copy(ETypeName, 11, Length(ETypeName));
+  if Length(ETypeName) = 0 then Exit;
+  // opearator
+  if ETypeName[2] = 'p' then Exit(cmtOperator);
+  if ETypeName[3] = 'n' then Exit(cmtConstant);
+  // overloaded we don't care
+  if ETypeName[1] = 'o' then ETypeName := Copy(ETypeName, 12, Length(ETypeName));
   
   if ETypeName[1] = 'f' then Exit(cmtFunction);
   if ETypeName[1] = 'c' then Exit(cmtConstructor);
@@ -301,7 +342,8 @@
   // the p's
   if ETypeName[4] = 'c' then Exit(cmtProcedure);
   if ETypeName[4] = 'p' then Exit(cmtProperty);
-  
+  // Unknown
+  // WriteLn(' Warning El name: '+ Element.Name+' path: '+Element.PathName+' TypeName: '+Element.ElementTypeName);
 end;
 
 procedure TCHMHTMLWriter.GenerateIndex;
@@ -315,7 +357,7 @@
   ParentElement: TPasElement;
   MemberItem: TChmSiteMapItem;
   Stream: TMemoryStream;
-  RedirectUrl,Urls: String;
+  RedirectUrl,Urls,SName: String;
 
 begin
   DoLog('Generating Index...');
@@ -356,7 +398,7 @@
 
           if(trim(RedirectUrl)<>'') and (RedirectUrl<>urls) then
             begin
-              writeln('Hint: Index Resolved:',urls,' to ',RedirectUrl);
+              //writeln('Hint: Index Resolved:',urls,' to ',RedirectUrl);
               urls:=RedirectUrl;
             end;
 
@@ -369,6 +411,8 @@
             cmtProperty    : TmpItem.Text := TmpElement.Name + ' property';
             cmtVariable    : TmpItem.Text := TmpElement.Name + ' variable';
             cmtInterface   : TmpItem.Text := TmpElement.Name + ' interface';
+            cmtOperator    : TmpItem.Text := TmpElement.Name + ' operator';
+            cmtConstant    : TmpItem.Text := TmpElement.Name + ' const';
             cmtUnknown     : TmpItem.Text := TmpElement.Name;
           end;
           TmpItem.addLocal(Urls);
@@ -389,18 +433,24 @@
       // routines
       for j := 0 to AModule.InterfaceSection.Functions.Count-1 do
       begin
-        ParentElement := TPasProcedureType(AModule.InterfaceSection.Functions[j]);
-        TmpItem := Index.Items.NewItem;
-        TmpItem.Text := ParentElement.Name + ' ' + ParentElement.ElementTypeName;
-        TmpItem.addLocal(FixHTMLpath(Allocator.GetFilename(ParentElement, 0)));
+        // routine name
+        ParentElement := TPasElement(AModule.InterfaceSection.Functions[j]);
+        case ElementType(ParentElement) of
+          cmtProcedure   : SName:= ' procedure';
+          cmtFunction    : SName:= ' function';
+          cmtOperator    : SName:= ' operator';
+          //cmtConstant    : SName:= ' const';
+          else             SName:= ' unknown'
+        end;
+        SName:= ParentElement.Name + ' ' + SName;
+        MultiAlphaItem(Index.Items, SName, ParentElement, AModule.Name);
       end;
       // consts
       for j := 0 to AModule.InterfaceSection.Consts.Count-1 do
       begin
         ParentElement := TPasElement(AModule.InterfaceSection.Consts[j]);
-        TmpItem := Index.Items.NewItem;
-        TmpItem.Text := ParentElement.Name;
-        TmpItem.addLocal(FixHTMLpath(Allocator.GetFilename(ParentElement, 0)));
+        SName:= ParentElement.Name + ' const';
+        MultiAlphaItem(Index.Items, SName, ParentElement, AModule.Name);
       end;
       // types
       for j := 0 to AModule.InterfaceSection.Types.Count-1 do
@@ -431,9 +481,8 @@
       for j := 0 to AModule.InterfaceSection.Variables.Count-1 do
       begin
         ParentElement := TPasElement(AModule.InterfaceSection.Variables[j]);
-        TmpItem := Index.Items.NewItem;
-        TmpItem.Text := ParentElement.Name + ' var';
-        TmpItem.addLocal(FixHTMLpath(Allocator.GetFilename(ParentElement, 0)));
+        SName:= ParentElement.Name + ' variable';
+        MultiAlphaItem(Index.Items, SName, ParentElement, AModule.Name);
       end;
       // declarations
       {
@@ -471,6 +520,7 @@
     FChm.AppendIndex(Stream);
     Stream.Free;
   end;
+  DoLog('Generating Index Done');
 end;
 
 procedure TCHMHTMLWriter.WriteHTMLPages;
@@ -548,6 +598,7 @@
 
   FChm.Execute;
   FChm.Free;
+  DoLog('Collecting done');
   // we don't need to free FTempUncompressed
   // FTempUncompressed.Free;
   FOutChm.Free;
Index: dw_html.pp
===================================================================
--- dw_html.pp	(revision 47893)
+++ dw_html.pp	(working copy)
@@ -53,6 +53,8 @@
     function GetCSSFilename(ARelativeTo: TPasElement): DOMString; virtual;
   end;
 
+  { TLongNameFileAllocator }
+
   TLongNameFileAllocator = class(TFileAllocator)
   private
     FExtension: String;
@@ -255,7 +257,6 @@
     // Start producing html complete package documentation
     procedure WriteHTMLPages; virtual;
     procedure WriteXHTMLPages;
-    function  ModuleForElement(AnElement:TPasElement):TPasModule;
 
     Function InterPretOption(Const Cmd,Arg : String) : boolean; override;
     Procedure WriteDoc; override;
@@ -276,7 +277,6 @@
     Property ImageFileList : TStrings Read FImageFileList;
   end;
 
-
 Function FixHTMLpath(S : String) : STring;
 
 implementation
@@ -310,7 +310,6 @@
 end;
 
 
-
 constructor TLongNameFileAllocator.Create(const AExtension: String);
 begin
   inherited Create;
@@ -331,12 +330,12 @@
     Result := 'index';
     excl := True;
   end
-  else if AElement.ClassType = TPasModule then
+    else if AElement.ClassType = TPasModule then
   begin
     Result := LowerCase(AElement.Name) + PathDelim + 'index';
     excl := True;
   end
-  else
+    else
   begin
     if AElement is TPasOperator then
     begin
@@ -371,9 +370,11 @@
       excl := (ASubindex > 0);
     end;
     // searching for TPasModule - it is on the 2nd level
-    if Assigned(AElement.Parent) then
-      while Assigned(AElement.Parent.Parent) do
-        AElement := AElement.Parent;
+    if AElement.GetModule <> nil then
+      AElement := AElement.GetModule // TODO: handle GetElementModule() = nil ?
+    else
+      Raise EFPDocWriterError.Create(
+      'TLongNameFileAllocator error: Unresolved module name for element: ' +AElement.PathName);
     // cut off Package Name
     Result := Copy(Result, Length(AElement.Parent.Name) + 2, MaxInt);
     // to skip dots in unit name
@@ -834,16 +835,7 @@
   end;
 end;
 
-function  THTMLWriter.ModuleForElement(AnElement:TPasElement):TPasModule;
 
-begin
-  result:=TPasModule(AnElement);
-  while assigned(result) and not (result is TPasModule) do 
-        result:=TPasModule(result.parent);
-  if not (result is TPasModule) then
-   result:=nil;
-end;
-
 procedure THTMLWriter.CreateCSSFile;
 
 Var
@@ -1691,7 +1683,7 @@
     end else
     begin
       Result := nil;
-      AppendText(Parent, Element.Name);
+      AppendText(Parent, Element.Name); // unresolved items
     end;
   end else
   begin
@@ -2294,7 +2286,7 @@
         else
           AppendText(NewEl,El['id']);
        l:=El['id'];
-       DescrEl := Engine.FindShortDescr(ModuleForElement(AElement),UTF8Encode(L));
+       DescrEl := Engine.FindShortDescr(AElement.GetModule,UTF8Encode(L));
        if Assigned(DescrEl) then
          begin
          AppendNbSp(CreatePara(CreateTD(TREl)), 2);
@@ -2494,7 +2486,7 @@
       if (PE<>Nil) then
         begin
         AppendHyperLink(CurOutputNode,PE);
-        PM:=ModuleForElement(PE);
+        PM:=PE.GetModule();
         if (PM<>Nil) then
           begin
           AppendText(CurOutputNode,' (');
@@ -3157,7 +3149,7 @@
   i: Integer;
   s: String;
   t : TPasType;
-  ah,ol,wt,ct,wc,cc  : boolean;
+  ah,ol,wt,ct,wc,cc : boolean;
   isRecord : Boolean;
 
 begin
@@ -3172,6 +3164,8 @@
       begin
       Member := TPasElement(Members[i]);
       MVisibility:=Member.Visibility;
+      cc:=(Member is TPasConst);
+      ct:=(Member is TPasType);
       ol:=(Member is TPasOverloadedProc);
       ah:=ol or ((Member is TPasProcedure) and (TPasProcedure(Member).ProcType.Args.Count > 0));
       if ol then
@@ -3178,24 +3172,16 @@
         Member:=TPasElement((Member as TPasOverloadedProc).Overloads[0]);
       if Not Engine.ShowElement(Member) then
         continue;
-      if (CurVisibility <> MVisibility) then
+      if (CurVisibility <> MVisibility) or (cc <> wc) or (ct <> wt) then
         begin
         CurVisibility := MVisibility;
+        wc:=cc;
+        wt:=ct;
         s:=VisibilityNames[MVisibility];
         AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), UTF8Decode(s));
+        if (ct) then AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), 'type');
+        if (cc) then AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), 'const');
         end;
-      ct:=(Member is TPasType);
-      if ct and (not wt) then
-        begin
-        AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), 'Type');
-        end;
-      wt:=ct;
-      cc:=(Member is TPasConst);
-      if cc and (not wc) then
-        begin
-        AppendKw(CreateCode(CreatePara(CreateTD(CreateTR(TableEl)))), 'Const');
-        end;
-      wc:=cc;
       TREl := CreateTR(TableEl);
       CodeEl := CreateCode(CreatePara(CreateTD_vtop(TREl)));
       AppendNbSp(CodeEl, 2);
@@ -3218,7 +3204,7 @@
         If Assigned(TPasConst(Member).VarType) then
           begin
           AppendSym(CodeEl, ' = ');
-          AppendTypeDecl(TPasType(Member),TableEl,CodeEl);
+          AppendTypeDecl(TPasType(TPasConst(Member).VarType),TableEl,CodeEl);
           end;
         AppendSym(CodeEl, ' = ');
         AppendText(CodeEl,UTF8Decode(TPasConst(Member).Expr.GetDeclaration(True)));
@@ -3270,7 +3256,7 @@
         else
           AppendText(CodeEl, UTF8Decode(Member.Name));
         AppendSym(CodeEl, ': ');
-        AppendHyperlink(CodeEl, TPasVariable(Member).VarType);
+        AppendType(CodeEl, TableEl, TPasVariable(Member).VarType,False);
         AppendSym(CodeEl, ';');
         end
       else
@@ -3490,6 +3476,7 @@
             AppendText(ParaEl, 'pt');
           visPublished:
             AppendText(ParaEl, 'pl');
+          else
         end;
         AppendNbSp(ParaEl, 1);
 
@@ -3558,6 +3545,7 @@
             AppendText(ParaEl, 'pt');
           visPublished:
             AppendText(ParaEl, 'pl');
+          else
         end;
         AppendNbSp(ParaEl, 1);
 
Index: fpdoc.pp
===================================================================
--- fpdoc.pp	(revision 47893)
+++ fpdoc.pp	(working copy)
@@ -55,8 +55,9 @@
     procedure OutputLog(Sender: TObject; const Msg: String);
     procedure ParseCommandLine;
     procedure ParseOption(const S: String);
-    Procedure Usage(AnExitCode : Byte);
-    Procedure DoRun; override;
+    procedure Usage(AnExitCode : Byte);
+    procedure ExceptProc(Sender: TObject; E: Exception);
+    procedure DoRun; override;
   Public
     Constructor Create(AOwner : TComponent); override;
     Destructor Destroy; override;
@@ -64,7 +65,7 @@
   end;
 
 
-Procedure TFPDocApplication.Usage(AnExitCode : Byte);
+procedure TFPDocApplication.Usage(AnExitCode: Byte);
 
 Var
   I,P : Integer;
@@ -148,6 +149,11 @@
   Halt(AnExitCode);
 end;
 
+procedure TFPDocApplication.ExceptProc(Sender: TObject; E: Exception);
+begin
+  OutputLog(Sender, DumpExceptionCallStack(E));
+end;
+
 destructor TFPDocApplication.Destroy;
 
 begin
@@ -427,6 +433,7 @@
   StopOnException:=true;
   FCreator:=TFPDocCreator.Create(Self);
   FCreator.OnLog:=@OutputLog;
+  OnException:= @ExceptProc;
 end;
 
 begin
patch_fpdoc_05.patch (17,117 bytes)   

Marco van de Voort

2020-12-30 18:15

manager   ~0127950

I reviewed the early patch this afternoon, but haven't rebuild and tested fully. Hope to do that tonight after dinner.

The good part is that it doesn't seem to touch the sensitive index to binary index and vice versa routines in package chm.

Only detail to fix I quickly see is a missing check for nil somewhere, there is a comment for that .

Andrey Sobol

2020-12-30 19:57

reporter   ~0127951

Marco,
Where is the wrong nill checking? I don`t see any comments.
Andrey.

Marco van de Voort

2020-12-30 20:17

manager   ~0127953

This part.

if AElement.GetModule <> nil then
+ AElement := AElement.GetModule // TODO: handle GetElementModule() = nil ?
+ else
+ Raise EFPDocWriterError.Create(
+ 'TLongNameFileAllocator error: Unresolved module name for element: ' +AElement.PathName);
     // cut off Package Name
     Result := Copy(Result, Length(AElement.Parent.Name) + 2, MaxInt);

Please provide any changes as additional patch. I'm already working with patch 5.

Andrey Sobol

2020-12-30 20:31

reporter   ~0127955

Here need to delete "TODO:" message (It is I wrote), I forgot to do that. Any element has to have a module. Here is the exactly raise.

Marco van de Voort

2020-12-30 21:42

manager   ~0127957

Last edited: 2020-12-30 21:42

View 2 revisions

I committed the patch. It all looks good, but the CHM files are smaller, specially lcl. That is not always a sign of problems though, sometimes the generated html suddenly compresses better.

RTL slightly larger number of files, LCL 30 less, but on a total of nearly 20000 that could be simply removed methods or so.

I noticed two things:
- functions in the index get "unknown". Probably some of the case statements need a mtfunction: or so.
   (see e.g. rtl.chm: strutils' ansi* functions)
- (not by this patch, already in 3.2.0 docs) interface declarations no longer have parent.

As to the original reported problem, in some old CHM I got some javascript errors in a popunder. This might be related to your original observation

Andrey Sobol

2020-12-31 06:21

reporter   ~0127961

Thank you for the commit, Marco.
Could you send to me a new *.chm and *.cxt from FPC, under windows i can produce only lcl.chm and upper. I also want to check out the result.
Also I want to know more about the "javascript errors in a popunder" , I didn`t understand, what is it "popunder" and where can I see that?
Andrey.

Marco van de Voort

2020-12-31 10:22

manager   ~0127964

pop under is when a window appears under a different window for some reason, being hidden by it. I accidentally came by it, but I have no reproduction.

http://www.stack.nl/~marcov/doc-chmbeta.zip

Marco van de Voort

2021-01-01 15:32

manager   ~0127995

Andrey, the generated indexes are smaller, see don's post at https://forum.lazarus.freepascal.org/index.php/topic,52437.0.html

I started with rtl.chm and changed chmls to easier diff the list of chm (chmls --no-offset) to make this easier diffable.

Strangely the RTL file is smaller while the files seem larger. It seems that this is mostly for the topics list #TOPICS,#URLSTR and #URLTBL (which list urls and their labels) and the fulltext index fiftimain. The urlstr/tbl file deduplicate urls so that might also be caused by higher reuse.

Unfortunately, the topics output is not very diffable, so I have no definite topics yet.

The main index and toc (default.hhk and default.hhc) are roughly the same in size. Most content is also larger except for some helper pages. (e.g. singlehelper and smallinthelper)

Marco van de Voort

2021-01-01 18:54

manager   ~0128002

Hmm, seems to be elsewhere. If I revert your changes, the fcl.chm is also smaller

Marco van de Voort

2021-01-01 19:01

manager   ~0128004

The problem is in fcl-passrc, not fpdoc.

Andrey Sobol

2021-01-01 22:06

reporter   ~0128006

Marco, with what version do you compare sizes? Before this patch was also another patch , that pach has changed indexes and full text search indexes, Maybe you haven't read previous description file. I not at home now, I can't write in detail.

Marco van de Voort

2021-01-01 22:09

manager   ~0128007

Last edited: 2021-01-01 22:25

View 2 revisions

I've already reviewed the -5 patch, and found nothing and then done some binsearch for which exact revision broke it . It is somewhere between 47718 and 47722, I therefore suspect r47719:

r47719 | michael | 2020-12-08 10:49:44 +0100 (di, 08 dec 2020) | 1 line

* Last patch from Andrey Sobol to fix bug ID 38141

Andrey Sobol

2021-01-01 22:32

reporter   ~0128008

This indexes was not broken, that I have excluded unusless files from full text search index.
That was popup pages with class's method, property, event pages, such as https://bugs.freepascal.org/file_download.php?file_id=34233&type=bug
These pages don't have names and usefull contents.

Andrey Sobol

2021-01-01 22:35

reporter   ~0128009

When i will return at home i check it more thoroughly.

Andrey Sobol

2021-01-22 15:15

reporter   ~0128484

I think that patch we can close. There are rev 48103 - rev 48269 , ones fix that issuue entire.

Marco van de Voort

2021-01-22 15:36

manager   ~0128486

I think too. Note that the smaller lazutils is fixed in lazarus r64396. Setting dialect options for some lazutils units,

Andrey Sobol

2021-01-22 15:48

reporter   ~0128487

Last edited: 2021-01-22 15:55

View 2 revisions

I don`t think such (setting dialect options), because for debuging of the lazlistclasses I don`t use those options. The Matias have made some changes inside a parser, The generic and specialize classes have resolved without of errors now. When Michael will place a last patch about of specialize, you can build new chm`s, there is my last version https://drive.google.com/drive/folders/1ci_GiciVwZei4PTyo_5QE5GLTppszwmI?usp=sharing

Issue History

Date Modified Username Field Change
2020-11-30 17:06 Andrey Sobol New Issue
2020-11-30 18:13 Marco van de Voort Note Added: 0127270
2020-12-01 10:24 Andrey Sobol Note Added: 0127291
2020-12-01 10:44 wp Note Added: 0127292
2020-12-01 13:26 Andrey Sobol Note Added: 0127297
2020-12-01 16:53 wp Note Added: 0127301
2020-12-01 17:02 Andrey Sobol Note Added: 0127302
2020-12-01 17:09 wp Note Added: 0127303
2020-12-13 23:40 Marco van de Voort Note Added: 0127600
2020-12-14 00:04 Andrey Sobol Note Added: 0127601
2020-12-14 00:09 Andrey Sobol Note Edited: 0127601 View Revisions
2020-12-14 14:18 Andrey Sobol Note Added: 0127608
2020-12-14 14:18 Andrey Sobol File Added: patch_fpdoc_04.patch
2020-12-14 14:18 Andrey Sobol File Added: VariableTypeShow_ProtectecFix_2020-12-14 01_23_26-.jpg
2020-12-14 14:18 Andrey Sobol File Added: 2020-12-14 01_49_57-G___PROJECTS_L01_Lazarus_contrib_patch_patch_fpdoc_04.jpg
2020-12-14 14:18 Andrey Sobol File Added: Debug_ln_2020-12-14 01_50_45-Greenshot image editor.jpg
2020-12-14 14:18 Andrey Sobol File Added: lcl_register_2020-12-14 01_46_01-lcl.jpg
2020-12-14 14:20 Andrey Sobol Note Added: 0127609
2020-12-14 14:20 Andrey Sobol File Added: patch_fpdoc_description_04_en.txt
2020-12-14 14:23 Andrey Sobol Note Edited: 0127608 View Revisions
2020-12-14 14:24 Andrey Sobol Note Edited: 0127608 View Revisions
2020-12-29 21:33 Andrey Sobol Note Added: 0127915
2020-12-30 17:38 Andrey Sobol Note Added: 0127948
2020-12-30 17:38 Andrey Sobol File Added: patch_fpdoc_05.patch
2020-12-30 17:56 Andrey Sobol Note Edited: 0127948 View Revisions
2020-12-30 18:15 Marco van de Voort Note Added: 0127950
2020-12-30 19:57 Andrey Sobol Note Added: 0127951
2020-12-30 20:17 Marco van de Voort Note Added: 0127953
2020-12-30 20:31 Andrey Sobol Note Added: 0127955
2020-12-30 21:37 Marco van de Voort Fixed in Revision => 47915
2020-12-30 21:37 Marco van de Voort FPCTarget => -
2020-12-30 21:42 Marco van de Voort Note Added: 0127957
2020-12-30 21:42 Marco van de Voort Note Edited: 0127957 View Revisions
2020-12-31 06:21 Andrey Sobol Note Added: 0127961
2020-12-31 10:22 Marco van de Voort Note Added: 0127964
2021-01-01 15:32 Marco van de Voort Note Added: 0127995
2021-01-01 18:54 Marco van de Voort Note Added: 0128002
2021-01-01 19:01 Marco van de Voort Note Added: 0128004
2021-01-01 22:06 Andrey Sobol Note Added: 0128006
2021-01-01 22:09 Marco van de Voort Note Added: 0128007
2021-01-01 22:25 Marco van de Voort Note Edited: 0128007 View Revisions
2021-01-01 22:32 Andrey Sobol Note Added: 0128008
2021-01-01 22:35 Andrey Sobol Note Added: 0128009
2021-01-22 15:15 Andrey Sobol Note Added: 0128484
2021-01-22 15:36 Marco van de Voort Assigned To => Marco van de Voort
2021-01-22 15:36 Marco van de Voort Status new => resolved
2021-01-22 15:36 Marco van de Voort Resolution open => fixed
2021-01-22 15:36 Marco van de Voort Note Added: 0128486
2021-01-22 15:48 Andrey Sobol Note Added: 0128487
2021-01-22 15:55 Andrey Sobol Note Edited: 0128487 View Revisions