summaryrefslogtreecommitdiffstats
path: root/doc/info.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/info.n')
-rw-r--r--doc/info.n21
1 files changed, 20 insertions, 1 deletions
diff --git a/doc/info.n b/doc/info.n
index a652c9d..951f492 100644
--- a/doc/info.n
+++ b/doc/info.n
@@ -7,7 +7,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: info.n,v 1.9 2004/02/17 04:55:27 hobbs Exp $
+'\" RCS: @(#) $Id: info.n,v 1.10 2004/05/28 10:49:09 dkf Exp $
'\"
.so man.macros
.TH info n 8.4 Tcl "Tcl Built-In Commands"
@@ -202,6 +202,25 @@ has each matching namespace variable qualified with the name
of its namespace.
Note that a currently-visible variable may not yet "exist" if it has not
been set (e.g. a variable declared but not set by \fBvariable\fR).
+.SH EXAMPLE
+This command prints out a procedure suitable for saving in a Tcl
+script:
+.CS
+proc printProc {procName} {
+ set result [list proc $procName]
+ set formals {}
+ foreach var [info args $procName] {
+ if {[info default $procName $var def]} {
+ lappend formals [list $var $def]
+ } else {
+ # Still need the list-quoting because variable
+ # names may properly contain spaces.
+ lappend formals [list $var]
+ }
+ }
+ puts [lappend result $formals [info body $procName]]
+}
+.CE
.SH "SEE ALSO"
global(n), proc(n)