Changeset 120 for trunk/readexp.tcl


Ignore:
Timestamp:
Dec 4, 2009 5:00:44 PM (11 years ago)
Author:
toby
Message:

# on 1999/11/17 22:05:04, toby did:
Add routines to delete history records

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/readexp.tcl

    • Property rcs:date changed from 1999/07/21 16:19:34 to 1999/11/17 22:05:04
    • Property rcs:lines changed from +5 -4 to +30 -2
    • Property rcs:rev changed from 1.10 to 1.11
    r90 r120  
    11411141    close $fp
    11421142}
     1143
     1144# history commands -- delete all but last $keep history records,
     1145# renumber if $renumber is true
     1146proc DeleteHistory {keep renumber} {
     1147    global exparray
     1148    foreach y [lrange [lsort -decreasing \
     1149            [array names exparray {    HSTRY*}]] $keep end] {
     1150        unset exparray($y)
     1151    }
     1152    if !$renumber return
     1153    # renumber
     1154    set i 0
     1155    foreach y [lsort -increasing \
     1156            [array names exparray {    HSTRY*}]] {
     1157        set key [format "    HSTRY%3d" [incr i]]
     1158        set exparray($key) $exparray($y)
     1159        unset exparray($y)
     1160    }
     1161    # list all history
     1162    #    foreach y [lsort -decreasing [array names exparray {    HSTRY*}]] {puts "$y $exparray($y)"}
     1163}
     1164
     1165proc CountHistory {} {
     1166    global exparray
     1167    return [llength [array names exparray {    HSTRY*}]]
     1168}
     1169
     1170
Note: See TracChangeset for help on using the changeset viewer.