I wonder if it is possible to have locally declared routines listed in the documentation page of a global function?
I am just diving into a rather large project written in Deplhi-5, the author(s) were keen on defining local routines in the namespace of another routine. It is hard to get and keep overview.
Best regards,
Olli
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
and sorry for taking this long, but I'm currently in the middle of other things.
The local functions are parsed - but directly after parsing them the information is freed. Only some parts are transfered to the main functions before that, like the list of used identifiers.
It's probably not that hard to add a few lines to add the names of the nested functions to a list in the main function and output them in the documentation. But as functions can be nested in already nested functions to arbitrary depths you'll have to decide what to do with them.
And this is also information about the implementation - while the documentation should generally center more on the interface.
So, as this functionality has several problems, I will probably not implement the output of the nested functions.
If you want to implement it yourself, you might have to do some extensive source diving as well. As a few pointers:
1. Add a list (TStringList?) to the type TFunction in unit Idents\UExtIdents.pas
2. In Parser\UNameSpaces.pas method TLocalFuncNameSpace.MoveGlobalIdentsTo add a line like:
NameSpace.FuncIdent.YourNestedFunctionList.Append(FFuncIdent.Name)
3. In Generator\IntermediaryComment\UICIdentDocBuilder.pas in TICIdentDocBuilder.HandleFunction check whether the list is not empty and add it.
For step 3 you might want to add another item to the enumeration type TICTopicForIdentifier in unit Generator\IntermediaryComment\UICNodes.pas in that case you have to handle it in the visitor of each generator of documentation you want to use. If you do not do that you can add the text and formattings directly, but this may result in awkward appearance in some of the generators.
Best regards,
Gerold Veith
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I wonder if it is possible to have locally declared routines listed in the documentation page of a global function?
I am just diving into a rather large project written in Deplhi-5, the author(s) were keen on defining local routines in the namespace of another routine. It is hard to get and keep overview.
Best regards,
Olli
Hello,
and sorry for taking this long, but I'm currently in the middle of other things.
The local functions are parsed - but directly after parsing them the information is freed. Only some parts are transfered to the main functions before that, like the list of used identifiers.
It's probably not that hard to add a few lines to add the names of the nested functions to a list in the main function and output them in the documentation. But as functions can be nested in already nested functions to arbitrary depths you'll have to decide what to do with them.
And this is also information about the implementation - while the documentation should generally center more on the interface.
So, as this functionality has several problems, I will probably not implement the output of the nested functions.
If you want to implement it yourself, you might have to do some extensive source diving as well. As a few pointers:
1. Add a list (TStringList?) to the type TFunction in unit Idents\UExtIdents.pas
2. In Parser\UNameSpaces.pas method TLocalFuncNameSpace.MoveGlobalIdentsTo add a line like:
NameSpace.FuncIdent.YourNestedFunctionList.Append(FFuncIdent.Name)
3. In Generator\IntermediaryComment\UICIdentDocBuilder.pas in TICIdentDocBuilder.HandleFunction check whether the list is not empty and add it.
For step 3 you might want to add another item to the enumeration type TICTopicForIdentifier in unit Generator\IntermediaryComment\UICNodes.pas in that case you have to handle it in the visitor of each generator of documentation you want to use. If you do not do that you can add the text and formattings directly, but this may result in awkward appearance in some of the generators.
Best regards,
Gerold Veith