Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-08

fpdoc fails to get full declaration of constants

11 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Running fpdoc over fpGUI code, the Linear Output Writer (LaTeX and new IPF output) for constants do not contain the full declaration.

The problem is detected inside the TLinearWriter.WriteConsts() method. Debugging the fpdoc code inside WriteConsts(), it retrieves the declaration as shown in the debug tooltip (screeenshot attached).

fpdoc (linear writer descendant):

clAliceBlue =

The actual code (inside an include file) is:

   clAliceBlue = TfpgColor($f0f8ff);

The problem seems to be localised to the Linear Output descendants. I double checked with the fpdoc HTML output, and the clAliceBlue declaration is full and correct.

I'm using FPC 2.5.1 Trunk (updated yesterday). Is this down to a fcl-passrc parser bug, or a fpdoc processing bug. I believe the latter is true because otherwise the HTML Writer output would also have been wrong.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys: Running fpdoc over fpGUI code, the Linear Output Writer (LaTeX and new IPF output) for…
Graeme Geldenhuys wrote 27 lines
Running fpdoc over fpGUI code, the Linear Output Writer (LaTeX and new IPF output) for constants do not contain the full declaration. The problem is detected inside the TLinearWriter.WriteConsts() method. Debugging the fpdoc code inside WriteConsts(), it retrieves the declaration as shown in the debug tooltip (screeenshot attached). fpdoc (linear writer descendant): clAliceBlue = The actual code (inside an include file) is: clAliceBlue = TfpgColor($f0f8ff); The problem seems to be localised to the Linear Output descendants. I double checked with the fpdoc HTML output, and the clAliceBlue declaration is full and correct. I'm using FPC 2.5.1 Trunk (updated yesterday). Is this down to a fcl-passrc parser bug, or a fpdoc processing bug. I believe the latter is true because otherwise the HTML Writer output would also have been wrong.

The bug is due to a fcl-passrc bug in pastree: each element should be able to output itself. The HTML code does not use this feature, but the linear output engine does.

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt

Op 2010-08-04 09:48, Michael Van Canneyt het geskryf:

The bug is due to a fcl-passrc bug in pastree: each element should be able to output itself. The HTML code does not use this feature, but the linear output engine does.

If you don't have time to look at it, any hints of where in the fcl-passrc code I should start looking for the bug. I don't know fcl-passrc code at all. The pastree unit doesn't look to big, so if the bug is in there, hopefully I can find it. If the parser failed to generate a token/node for the required constant value information, then that's another story.

I can confirm that the following fpdoc output all have this bug:
* Plain Text (txt)
* LaTeX (latex)
* Rich Text (rtf)
* New IPF (ipf)

Not sure about
* Man (this gives an Access Violation when run)
* XML (this gives an Access Violation when run)

This means your can't generate new documentation for FPC 2.4.2 release either. ;-)

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 26 lines
Op 2010-08-04 09:48, Michael Van Canneyt het geskryf: > > The bug is due to a fcl-passrc bug in pastree: each element should be able to output itself. > The HTML code does not use this feature, but the linear output engine does. If you don't have time to look at it, any hints of where in the fcl-passrc code I should start looking for the bug. I don't know fcl-passrc code at all. The pastree unit doesn't look to big, so if the bug is in there, hopefully I can find it. If the parser failed to generate a token/node for the required constant value information, then that's another story. I can confirm that the following fpdoc output all have this bug: * Plain Text (txt) * LaTeX (latex) * Rich Text (rtf) * New IPF (ipf) Not sure about * Man (this gives an Access Violation when run) * XML (this gives an Access Violation when run) This means your can't generate new documentation for FPC 2.4.2 release either. ;-)

No, since we use the version in the fixes branch. That should not have the bug. It is the new expression support which creates the bug...

In the pastree unit, the TPasExpr class must be made a descendent of TPasElement.

Then the classes
TUnaryExpr,TBinaryExpr,TPrimitiveExpr,TBoolConstExpr,TNilExpr,TParamsExpr,TRecordValues,TArrayValues must override the

   function GetDeclaration(full : Boolean) : string; virtual;

function to output the pascal code that corresponds to the expression.

And finally
TPasVariable.GetDeclaration must be adapted so it adds Expr.GetDeclaration(Full) to the output.

Michael.

Reply by email

Marco van de Voort
to Michael Van Canneyt

In our previous episode, Michael Van Canneyt said:

No, since we use the version in the fixes branch. That should not have the bug. It is the new expression support which creates the bug...

I hopefully fixed most of the "deprecated" bugs yesterday evening (mantis 16342).

I was planning to have a look at const node anyway today. (see same mantis) If I have time, and understand what I'm doing I'll have a look at the rest too (but I doubt expression writing is as easy as in the past, when the expression was one string)

Reply by email

Michael Van Canneyt
to Marco van de Voort
Marco van de Voort wrote 6 lines
In our previous episode, Michael Van Canneyt said: > No, since we use the version in the fixes branch. That should not have the bug. > It is the new expression support which creates the bug... I hopefully fixed most of the "deprecated" bugs yesterday evening (mantis 16342).

Aha ? Congratulations, nice job :-)

Show quoted text 5 lines
I was planning to have a look at const node anyway today. (see same mantis) If I have time, and understand what I'm doing I'll have a look at the rest too (but I doubt expression writing is as easy as in the past, when the expression was one string)

Writing it out is not a problem.
If you take care of the const node, I'll handle the writing.

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt

Op 2010-08-04 11:29, Michael Van Canneyt het geskryf:

Writing it out is not a problem. If you take care of the const node, I'll handle the writing.

Thanks guys, this is much appreciated. I'll take a close look at the last few commits of fpdoc and fcl-passrc to learn some of the code. I'll be using the parser a lot more in two of my projects I am working on, so I'll need to find my way around that code anyway.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Marco van de Voort
to Graeme Geldenhuys

In our previous episode, Graeme Geldenhuys said:

Show quoted text 8 lines
> > Writing it out is not a problem. > If you take care of the const node, I'll handle the writing. Thanks guys, this is much appreciated. I'll take a close look at the last few commits of fpdoc and fcl-passrc to learn some of the code. I'll be using the parser a lot more in two of my projects I am working on, so I'll need to find my way around that code anyway.

See also comments in mantis 16342, and realize that the fact that semicolons can be omitted (see example) and that library is an own token are the main things to watch out for.

Reply by email

Vincent Snijders
to Marco van de Voort

2010/8/4 Marco van de Voort :

Show quoted text 13 lines
In our previous episode, Graeme Geldenhuys said: > > > > Writing it out is not a problem. > > If you take care of the const node, I'll handle the writing. > > Thanks guys, this is much appreciated. I'll take a close look at the last > few commits of fpdoc and fcl-passrc to learn some of the code. I'll be > using the parser a lot more in two of my projects I am working on, so I'll > need to find my way around that code anyway. See also comments in mantis 16342, and realize that the fact that semicolons can be omitted (see example) and that library is an own token are the main things to watch out for.
Additionally fpdoc cannot parse the following const declaration:
const
  DefaultLogFont: TLogFont = (lfHeight:0;
    lfWidth:0;
    lfEscapement:0;
    lfOrientation:0;
    lfWeight:0;
    lfItalic:0;
    lfUnderline:0;
    lfStrikeOut:0;
    lfCharSet:0;
    lfOutPrecision:0;
    lfClipPrecision:0;
    lfQuality:0;
    lfPitchAndFamily:0;
    lfFaceName:'default';
  );

Note the semi colon before the ) at the end.

Shall I create a new bug report for it? Or is it better to just remove that semi colon. The compiler seems to accept both syntaxes.

Vincent

Reply by email

Vincent Snijders
to Marco van de Voort: In our previous episode, Graeme Geldenhuys said: See also comments in mantis 16342, and…

2010/8/4 Marco van de Voort :

Show quoted text 13 lines
In our previous episode, Graeme Geldenhuys said: > > > > Writing it out is not a problem. > > If you take care of the const node, I'll handle the writing. > > Thanks guys, this is much appreciated. I'll take a close look at the last > few commits of fpdoc and fcl-passrc to learn some of the code. I'll be > using the parser a lot more in two of my projects I am working on, so I'll > need to find my way around that code anyway. See also comments in mantis 16342, and realize that the fact that semicolons can be omitted (see example) and that library is an own token are the main things to watch out for.

While testing fpdoc on the LCL, I found another issue: http://bugs.freepascal.org/view.php?id=17110

Vincent

Reply by email