]>
git.zerfleddert.de Git - micropolis/blob - src/tclx/tclsrc/showproc.tcl
33e9c85bee2c84903458202edac7d6ce4e1a04ca
4 # Display procedure headers and bodies.
5 #------------------------------------------------------------------------------
6 # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
8 # Permission to use, copy, modify, and distribute this software and its
9 # documentation for any purpose and without fee is hereby granted, provided
10 # that the above copyright notice appear in all copies. Karl Lehenbauer and
11 # Mark Diekhans make no representations about the suitability of this
12 # software for any purpose. It is provided "as is" without express or
14 #------------------------------------------------------------------------------
15 # $Id: showprocs.tcl,v 2.0 1992/10/16 04:52:11 markd Rel $
16 #------------------------------------------------------------------------------
19 #@package: TclX-show_procedures showproc showprocs
21 proc showproc
{procname
} {
22 if [lempty
[info procs
$procname]] {demand_load
$procname}
23 set arglist
[info args
$procname]
25 while {[llength $arglist] > 0} {
26 set varg
[lvarpop arglist
0]
27 if [info default $procname $varg defarg
] {
28 lappend nargs
[list $varg $defarg]
33 format "proc %s \{%s\} \{%s\}\n" $procname $nargs [info body
$procname]
36 proc showprocs
{args
} {
37 if [lempty
$args] { set args
[info procs
] }
41 foreach j
$i { append out
[showproc
$j] "\n"}