Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Procedures of a Unit

Status
Not open for further replies.

beltijs

Programmer
Sep 11, 2003
25
AR
I want to make a List of Procedures i have in a unit at runtime. Is there a way to read each procedure of a unit and put it in a List?
 
hi

I don't know any functions off the top of my head but my first thought was read the .pas files as plain text files and search each line of the header for 'function' and 'procedure' and then stopping when you hit 'implementation'.

lou

 
I think it would be a lot more complicated than that.

For example:
[tt]
/*
procedure this_is_a_comment_not_a_procedure();
*/

type TSomething = class(TObject)
private
function this_is_a_private_method:boolean;
end;

procedure
/* this is a comment */
this_really_is_a_procedure();
[/tt]



You might be able to "borrow" some code from the
pasdoc project to get what you need:
 
Getting procedure names at runtime seems a strange thing to do, unless you writing a source documenting program.

Check out Run Time Type Information (RTTI). This allows you to interrogate published object properties at run time. If you are looking for the existence of specific routines, turn them into published properties and you are away.

Another approach is to use COM interfaces, which can also be interrogated at run time (but ask someone else how to <g>)

Have fun
Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top