For Programmers: Free Programming Magazines  


Home > Archive > Tcl > April 2007 > Re: Tcl Package question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Tcl Package question
M. Strobel

2007-04-22, 7:06 pm

quynhvanmac@gmail.com schrieb:
> Is there a way to list all procedure/function APIs that are available
> in a giving package that users can use. No, the internal api won't get
> listed. Thanks.
>


Hi,

as has been said already "info commands" is your friend, and will give
you a starting point.

This script lists all available commands:-------------



proc listNamespaceChildren { {ns ::}} {
listNamespaceCommands $ns
set l [namespace children $ns]
if { [llength $l] > 0 } {
foreach {e} $l {
puts "found namespace $e"
listNamespaceChildren $e
}
}
}


proc listNamespaceCommands { {ns ::}} {
if {[string length $ns] < 3} then {set stern "*"} else {set stern "::*" }
puts "---------- \tAll commands / procedures in namespace $ns$stern
\t----------"
puts stdout "[lsort [info commands $ns$stern ]]"
}


listNamespaceChildren ::

------------------
Max
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com