Changeset 2083 for trunk/base


Ignore:
Timestamp:
Feb 26, 2003, 10:06:12 AM (21 years ago)
Author:
kevin
Message:

Minor bugfixes.

Location:
trunk/base/src/darwinports1.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/darwinports1.0/darwinports_dlist.tcl

    r2081 r2083  
    133133#       value - the value to append to the key
    134134
    135 proc ditem_append {ditem key value} {
    136         return [darwinports_dlist::ditem_append $ditem $key $value]
     135proc ditem_append {ditem key args} {
     136        eval "return \[darwinports_dlist::ditem_append $ditem $key $args\]"
    137137}
    138138
     
    143143#       key   - the key to examine
    144144#       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]"
     145proc ditem_contains {ditem key args} {
     146        eval "return \[darwinports_dlist::ditem_contains $ditem $key $args\]"
    147147}
    148148
     
    253253                        # statusdict notation is 1 for success
    254254                        if {[catch {$handler $ditem} result]} {
    255                                 # debug puts the result?
    256                                 set result 1
     255                                puts $result
     256                                return $dlist
    257257                        }
    258258                        # No news is good news at this point.
     
    305305}
    306306
    307 proc ditem_append {ditem key value} {
     307proc ditem_append {ditem key args} {
    308308        variable $ditem
    309309        set x [lindex [array get $ditem $key] 1]
    310310        if {$x != {}} {
    311                 eval "lappend x $value"
     311                eval "lappend x $args"
    312312        } else {
    313                 set x $value
     313                set x $args
    314314        }
    315315        array set $ditem [list $key $x]
     
    317317}
    318318
    319 proc ditem_contains {ditem key {value}} {
     319proc ditem_contains {ditem key args} {
    320320        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)\]"
    323323        } else {
    324324                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} {
    326326                        return 1
    327327                } else {
  • trunk/base/src/darwinports1.0/test_dlist.tcl

    r2081 r2083  
    3535
    3636puts -nonewline "Checking ditem_contains... "
     37set value2 ""
    3738if {[catch {ditem_contains $ditem provides "foo"} value] || $value != 1 ||
    3839        [catch {ditem_contains $ditem provides "zzz"} value2] || $value2 != 0} {
Note: See TracChangeset for help on using the changeset viewer.