2 # Print the contents of a global array in command window.
4 # Copyright (c) 1991-1993 The Regents of the University of California.
5 # Copyright (c) 1994 Sun Microsystems, Inc.
6 # Copyright (c) 1995 Christian Werner
8 # See the file "license.terms" for information on usage and redistribution
9 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 proc parray {a {pattern *}} {
14 if ![array exists array] {
15 error "\"$a\" isn't an array"
18 foreach name [lsort [array names array $pattern]] {
19 if {[string length $name] > $maxl} {
20 set maxl [string length $name]
24 set maxl [expr {$maxl + [string length $a] + 2}]
25 foreach name [lsort [array names array $pattern]] {
26 set nameString [format %s(%s) $a $name]
28 [format "set %-*s %s\n" $maxl $nameString [list $array($name)]]