Forum OpenACS Development: Get proc names

Collapse
Posted by Enrique Catalan on
Hi,

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 =)

Collapse
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

Collapse
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. https://openacs.org/api-doc/procs-file-view?path=packages%2facs%2dlang%2ftcl%2flocalization%2dprocs%2etcl

hope this helps,
Brian

Collapse
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! =)