]> www.wagner.pp.ru Git - oss/ck.git/blob - library/showproc.tcl
Ck console graphics toolkit
[oss/ck.git] / library / showproc.tcl
1 #
2 # showproc.tcl --
3 #
4 # This file defines a command for retrieving Tcl procedures.
5 #
6 # Copyright (c) 1996 Christian Werner
7 #
8 # See the file "license.terms" for information on usage and redistribution
9 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10
11 proc showproc args {
12     set result {}
13     if {[llength $args] == 0} {
14         set args *
15     }
16     foreach i $args {
17         foreach k [info procs $i] {
18             set procs($k) {}
19         }
20     }
21     foreach i [lsort -ascii [array names procs]] {
22         set proc proc
23         lappend proc $i
24         set args {}
25         foreach k [info args $i] {
26             if [info default $i $k value] {
27                 lappend args [list $k $value]
28             } else {
29                 lappend args $k
30             }
31         }
32         lappend proc $args
33         lappend proc [info body $i]
34         lappend result $proc
35     }
36     return [join $result "\n\n"]
37 }
38
39