Forum OpenACS Development: Get proc names

Posted by Enrique Catalan on

Do you know if there is any proc or easy way to get a list of the names of each proc defined in a tcl library?

For example,

If I have a library called: ..../packages/foo_pkg/tcl/foo_lib.tcl and it contains definitions for N procs :

ad_proc -public foo_proc1 {} {} .
ad_proc -public foo_proc2 {} {} .
ad_proc -private foo_proc3 {} {} .
ad_proc -public foo_proc(N-1) {} {} .
ad_proc -private foo_procN {} {} .

What I would like to do is something like
% set proc_names_list [get_proc_names $library_path_file]
and get this { foo_proc1 foo_proc2 ..... foo_procN }

Any ideas apart of using a regexp or string match?

Thanks =)

2: Re: Get proc names (response to 1)
Posted by Gustaf Neumann on
put your procs into your own namespace (e.g. ::foo) and call [info commands ::foo::*]

-gustaf neumann

3: Re: Get proc names (response to 1)
Posted by Brian Fenton on
Hi Enrique

There is code in the API Doc which shows all procs in a file e.g.

hope this helps,

4: Re: Get proc names (response to 1)
Posted by Enrique Catalan on
The first one, that Gustaf said, works pretty well with fixed namespaces values or when you know the namespace or any pattern to match the procs names. I solved one problem here.

When the only info I've got is the file's name&path (the tcl library) that contains all the procs and I don't know the namespace and regexp pattern, I had to use Bryan's solution which is using the api-doc browser code doing a:

% nsv_get api_proc_doc_scripts packages/foo_pkg/tcl/foo_lib.tcl

Thanks guys! =)