[fpc-devel] fpdoc and fv

Marco van de Voort marcov at stack.nl
Sat Aug 23 20:34:31 CEST 2008


In our previous episode, Michael Van Canneyt said:
> > 216 in the IDE only. That's a rough count using 
> > 
> > egrep -i "=[ ]?object[ ]?\(" *  
> 
> Ah, objects. OK. Because for classes the numbers are discouraging:
> 
> - 100 classes in RTL
> - 1267 in packages
> - 573 in compiler
> - 3660 in Lazarus

It's still an automated method. Ok, the grep will take half a minute instead
of 2 seconds.

So that is not the problem, the problem could be conflicting names and
duplicate declarations under ifdef. 

Also if object() syntax is used for classes, you need to also grep for
object(). 

If they are a few, that is not a problem, and you can toy with it. 

> > There might be a few duplicates due to ifdef declaration (e.g. for TV2.0
> > outline support).
> > 
> > It is probably easy to make a postprocessor for the egrep output that
> > constructs a tree and writes .ps format. It can even comment the unit names
> > if needed.
> > 
> > I'll see if I can hack something up, since I need something printable NOW.
> 
> I'm curious :-)

It's simple tree building; below is the rough script + data I made this
afternoon:

http://www.stack.nl/~marcov/classchartstuff.zip

ide.txt,fv.txt,rtl.txt are the outputs of the grep (with another filter to
filter out svn dirs). Also I removed a few OS/2 only objects from rtl.txt

These files are catted together (see shellscript) and passed through the +/-
150 line fpc filter script.

The result is output.txt which has first some warnings, and then the rough
.ps output.

To use classes you need to fix the egrep and the split function in the
filter program. That split function is too simplistic and unsafe anyway,
something you'll hit for sure with larger bodies of code. (e.g. comments
after the class declarations, stuff like 

x = class (thespaceafterhis ) // xx

will go wrong, but that is trivially fixed. Unitnames are stored though,
since it was both easy, and makes manually fixing the warnings easier. 

Note that this is a quick'ndirty script solution. I still think the long run
fpdoc based solution is way better, reliable and maintainable. (and deals
with the ifdef problem, and can provide a classchart with links etc) 

But this could be done quickly in +/- 2 hrs.




More information about the fpc-devel mailing list