[fpc-devel] MakeSkel etc. programs

Michael Van Canneyt michael at freepascal.org
Wed Dec 14 23:40:46 CET 2011



On Wed, 14 Dec 2011, Hans-Peter Diettrich wrote:

> I just tried to extend the programs in the fpdoc folder, morphing the program 
> files into unit files by conditional compilation:
>
> {$IFDEF DoDi}
> unit ...;
> interface
> {$ELSE}
> program ...;
> {$ENDIF}
>
> etc., no problem so far.
>
> Then I wrote my own MkSkel program, using MakeSkel as a unit. Also fine :-)
>
> Then I tried to extend the functionality with wildcards, what also worked 
> fine after some more adjustments. E.g. I added an OnOption handler, that 
> handles additional commandline options, which are not recognized by the 
> ParseOption procedure.
>
> BTW is it really required to add "-Fi.", so that the parser finds include 
> files in the current directory (of the unit file)?

To my knowledge, it should not be necessary ?

> When I tried to create the skeletons for all *.pas and *.pp files, I stumbled 
> across exceptions with missing interface sections. It would be nice to 
> prevent such exceptions, when MakeSkel tries to process an program file, 
> whereupon AModule.InterfaceSection is Nil!

makeskel or fpdoc were not designed to be run on programs, so the errors are normal.

>
> Then I was very astonished about "No Interface section in MakeSkel" messages, 
> and it took me some time to find the bug in UnitDiff.pp, which contains
>  program MakeSkel;
> instead of
>  program *UnitDiff*;
> Please fix this glitch.

Fixed and committed. Rev. 19850.

> When I finally made --update work for a couple of units, in one run, another 
> bug popped up: MakeSkel seems to misinterpret the following in TestUnit.pp, 
> most probably at:
>
>  ARecordVar : Record
>                 A,B : integer;
>               end;
>
> A variable ARecordVar is added to the docs, *and* two variables A and B, 
> which IMO better should become ARecordVar.A and ARecordVar.B. When the unit 
> is updated later, these variables A and B are added to the output again - 
> what made me find this bug. When somebody fixes this bug, will it be possible 
> to also suppress the creation of empty output files? This will simplify the 
> separation of changed units from unchanged ones, where  currently all created 
> files have to be inspected for real changes manually :-(

This is a known problem, which I haven't gotten around to fixing yet. 
I am currently working on the parser; Hopefully I'll be able to fix this too.

> Now I'll try to further extend MkSkel by using FPDoc projects, so that the 
> correct input specifications are used, including all compiler options. Then 
> it will be easy to check the RTL and other packages for updates, and to 
> create the skeletons for all contained units :-)

If you do so, and intend to provide a patch, please keep the patch clean. 
All your other patches were mostly unusable because of all the 'noise' 
in them, forcing me to re-implement almost from scratch whatever you did.

Michael.



More information about the fpc-devel mailing list