Changeset 2083 for trunk/base
- Timestamp:
- Feb 26, 2003, 10:06:12 AM (21 years ago)
- Location:
- trunk/base/src/darwinports1.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/base/src/darwinports1.0/darwinports_dlist.tcl
r2081 r2083 133 133 # value - the value to append to the key 134 134 135 proc ditem_append {ditem key value} {136 return [darwinports_dlist::ditem_append $ditem $key $value]135 proc ditem_append {ditem key args} { 136 eval "return \[darwinports_dlist::ditem_append $ditem $key $args\]" 137 137 } 138 138 … … 143 143 # key - the key to examine 144 144 # value - optional value to search for in the key 145 proc ditem_contains {ditem key {value}} {146 eval "return [darwinports_dlist::ditem_contains $ditem $key $value]"145 proc ditem_contains {ditem key args} { 146 eval "return \[darwinports_dlist::ditem_contains $ditem $key $args\]" 147 147 } 148 148 … … 253 253 # statusdict notation is 1 for success 254 254 if {[catch {$handler $ditem} result]} { 255 # debug puts the result?256 set result 1255 puts $result 256 return $dlist 257 257 } 258 258 # No news is good news at this point. … … 305 305 } 306 306 307 proc ditem_append {ditem key value} {307 proc ditem_append {ditem key args} { 308 308 variable $ditem 309 309 set x [lindex [array get $ditem $key] 1] 310 310 if {$x != {}} { 311 eval "lappend x $ value"311 eval "lappend x $args" 312 312 } else { 313 set x $ value313 set x $args 314 314 } 315 315 array set $ditem [list $key $x] … … 317 317 } 318 318 319 proc ditem_contains {ditem key {value}} {319 proc ditem_contains {ditem key args} { 320 320 variable $ditem 321 if { ![info exists value]} {322 return [info exists ${ditem}($key)]321 if {[llength $args] == 0} { 322 eval "return \[info exists ${ditem}($key)\]" 323 323 } else { 324 324 set x [lindex [array get $ditem $key] 1] 325 if {[llength $x] > 0 && [lsearch -exact $x $value] != -1} {325 if {[llength $x] > 0 && [lsearch -exact $x [lindex $args 0]] != -1} { 326 326 return 1 327 327 } else { -
trunk/base/src/darwinports1.0/test_dlist.tcl
r2081 r2083 35 35 36 36 puts -nonewline "Checking ditem_contains... " 37 set value2 "" 37 38 if {[catch {ditem_contains $ditem provides "foo"} value] || $value != 1 || 38 39 [catch {ditem_contains $ditem provides "zzz"} value2] || $value2 != 0} {
Note: See TracChangeset
for help on using the changeset viewer.