Calum> I have one possible bug report:
Calum> When using the "Select by name" menu option, using a regular
Calum> expression of the form "j*" for example (without the quotes)
Calum> causes an incorrect set of hosts to be selected, and the
Calum> Select menu remains "greyed-out" and cannot be used further.
Calum> The rest of tkined continues as normal...
I hopefully fixed the bug (patch below). I also added support for
regular and globstyle expressions, since a regular expression like
"j*" matches everything (did you want that?) and it is much easier
just to write "*.uk" instead "\.uk$" :-).
Juergen
*** tkined_commands.tcl Fri Jan 7 11:55:35 1994
--- /usr/users/eos/schoenw/NetMan/tkined-0.7b/tkined_commands.tcl Wed Feb 2 19:06:11 1994
***************
*** 429,459 ****
}
}
! proc tkined_select_name_command {w} {
! static regex
if {![info exists regex]} { set regex "" }
set regex [tkined_request $w.canvas "Select objects by name." {} \
! "Enter a regular expression:" "{{} $regex}"]
if {$regex==""} return
foreach id [tkined_retrieve $w.canvas] {
! if {[regexp -nocase $regex [$id name]]} {
! $id select
! }
}
}
! proc tkined_select_address_command {w} {
! static regex
if {![info exists regex]} { set regex "" }
set regex [tkined_request $w.canvas "Select objects by address." {} \
! "Enter a regular expression:" "{{} $regex}"]
if {$regex==""} return
foreach id [tkined_retrieve $w.canvas] {
! if {[regexp -nocase $regex [$id name]]} {
! $id select
! }
}
}
--- 412,476 ----
}
}
! proc tkined_select_name_command { w } {
!
! static regex type
if {![info exists regex]} { set regex "" }
+ if {![info exists type]} { set type "glob" }
+
set regex [tkined_request $w.canvas "Select objects by name." {} \
! "{{Expression:} $regex} {Type: $type radio regexp glob}"]
if {$regex==""} return
+ set type [lindex $regex 1]
+ set regex [lindex $regex 0]
+
+ # test if the regex is valid
+ if {[catch {lsearch -$type foobar $regex} res]} {
+ tkined_acknowledge $w.canvas \
+ "$regex is not a valid $type expression!"
+ return
+ }
+
foreach id [tkined_retrieve $w.canvas] {
! # not all object types are selectable
! catch {
! if {[lsearch -$type [$id name] $regex] >= 0} {
! $id select
! }
! }
}
}
! proc tkined_select_address_command { w } {
!
! static regex type
if {![info exists regex]} { set regex "" }
+ if {![info exists type]} { set type "glob" }
+
set regex [tkined_request $w.canvas "Select objects by address." {} \
! "{{Expression:} $regex} {Type: $type radio regexp glob}"]
if {$regex==""} return
+ set type [lindex $regex 1]
+ set regex [lindex $regex 0]
+
+ # test if the regex is valid
+ if {[catch {lsearch -$type foobar $regex} res]} {
+ tkined_acknowledge $w.canvas \
+ "$regex is not a valid $type expression!"
+ return
+ }
+
foreach id [tkined_retrieve $w.canvas] {
! # not all object types are selectable
! catch {
! if {[lsearch -$type [$id address] $regex] >= 0} {
! $id select
! }
! }
}
}