There is no general answer to this question, since Tcl allows you to declare procedures on the fly, so they cannot have an actual file link.
There are some attempts to improve the situation for procs that have a defining file, for example TIP280 , which is actually available as an info frame in recent versions 8.5 and TIP 86, which is just being discussed.
But if simple grep does not work, you can keep track of when the procedure or command was created.
This happens in different places (Tcl OO can add a few more, not sure):
- During the
load command, when a binary extension registers its command handler functions with Tcl_CreateCommand or the more modern Tcl_CreateObjCommand. - During the
source command, when the proc definition file is loaded - When running the
proc to define a new procedure
Using the commands info commands and namespace children , you can go through the entire tree of namespaces to get a list of specific commands before and after the command. This way you can create a shell that tracks any new commands. See http://wiki.tcl.tk/1489 for some tips on how to do this.
Or just use a debugger like RamDebugger http://www.compassis.com/ramdebugger/Intro or the commercial ActiveStates debugger.
source share