Changeset 15 for trunk/readexp.tcl
- Timestamp:
- Dec 4, 2009 4:58:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/readexp.tcl
- Property rcs:date changed from 1998/12/28 02:34:29 to 1999/01/01 18:30:08
- Property rcs:lines changed from +4 -2 to +48 -1
- Property rcs:rev changed from 1.2 to 1.3
r13 r15 145 145 } 146 146 147 # return the number of records matching ISAM key (may contain wildcards) 148 proc existsexp {key} { 149 global exparray 150 # key can contain wild cards so dont pad 151 return [llength [array names exparray $key]] 152 } 153 154 147 155 # replace a section of the exparray with $value 148 156 # replace $char characters starting at character $start (numbered from 1) … … 183 191 } 184 192 193 # delete an exp recorde 194 # returns 1 if OK; 0 if not found 195 proc delexp {key} { 196 global exparray 197 # truncate long keys & pad short ones 198 set key [string range "$key " 0 11] 199 if [catch {unset exparray($key)}] { 200 return 0 201 } 202 return 1 203 } 185 204 # test an argument if it is a valid number; reform the number to fit 186 205 proc validreal {val length decimal} { … … 212 231 } 213 232 233 # process history information 234 # action == last 235 # returns number and value of last record 236 # action == add 237 # 238 proc exphistory {action "value 0"} { 239 global exparray 240 if {$action == "last"} { 241 set key [lindex [lsort -decreasing [array names exparray *HSTRY*]] 0] 242 if {$key == ""} {return ""} 243 return [list [string trim [string range $key 9 end]] $exparray($key)] 244 } elseif {$action == "add"} { 245 set key [lindex [lsort -decreasing [array names exparray *HSTRY*]] 0] 246 if {$key == ""} { 247 set key " HSTRY 1" 248 } else { 249 set index [string trim [string range $key 9 end]] 250 if {$index != "***"} { 251 if {$index < 999} {incr index} 252 set key [format " HSTRY%3d" $index] 253 set exparray($key) $value 254 } 255 } 256 set key [format " HSTRY%3d" $index] 257 set exparray($key) $value 258 } 259 } 214 260 # get overall info 215 261 # parm: … … 245 291 proc cdatget {key} { 246 292 foreach i {1 2 3 4 5 6 7 8 9} { 293 if {[existsexp " GNLS CDAT$i"] == 0} break 247 294 set line [readexp " GNLS CDAT$i"] 248 295 if {$line == {}} break
Note: See TracChangeset
for help on using the changeset viewer.