OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [library/] [parray.tcl] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# parray:
2
# Print the contents of a global array on stdout.
3
#
4
# RCS: @(#) $Id: parray.tcl,v 1.1.1.1 2002-01-16 10:25:30 markom Exp $
5
#
6
# Copyright (c) 1991-1993 The Regents of the University of California.
7
# Copyright (c) 1994 Sun Microsystems, Inc.
8
#
9
# See the file "license.terms" for information on usage and redistribution
10
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11
#
12
 
13
proc parray {a {pattern *}} {
14
    upvar 1 $a array
15
    if {![array exists array]} {
16
        error "\"$a\" isn't an array"
17
    }
18
    set maxl 0
19
    foreach name [lsort [array names array $pattern]] {
20
        if {[string length $name] > $maxl} {
21
            set maxl [string length $name]
22
        }
23
    }
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]
27
        puts stdout [format "%-*s = %s" $maxl $nameString $array($name)]
28
    }
29
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.