[fpc-devel] FPDoc imports

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed Feb 1 19:39:49 CET 2012


michael.vancanneyt at wisa.be schrieb:

> Why do you need this ? You make it quite complicated.
> 
> All you need is a FindModule(Const AName,AFileHint : String) : 
> TPasModule call in TPasTreeContainer which must be overridden in a 
> descendent (such as TFPDocEngine). The default implementation returns nil.
> 
> This call can search the module list if it has one.

But it does not have such a list :-(

> If it doesn't find 
> it, it can then decide to parse it anyway and return the just-parsed 
> instance.

This requires a list of the Inputs (compiler parameters), which only 
exists in TFPDocCreator. It also requires a list of units being or 
having been parsed. When a parser is started for a new unit, it doesn't 
return the created TPasModule until finished, so that TPasTreeContainer 
cannot tell whether FindModule addresses a module that has not been 
parsed yet, or one that already is being parsed, but not finished.

> All the parser needs to do is call FindModule whenever it encounters a unit
> in a uses clause; The rest will happen then automagically.

I found it much more complicated, after a look at the existing code.

> Then you can create a TPasTreeContainer descendent called 
> TModulesPasTreeContainer which keeps a list of modules and which 
> implements FindModule with the above described recursive mechanism.

Then I'll follow this route, as outlined in the last paragraph of my 
message.

DoDi




More information about the fpc-devel mailing list