return [string length $notes_loc]
}
proc have-ownership {} {
+ global pirate
return [expr {[have-notes] && [string length $pirate]}]
}
set cmd {./yarrg --find-window-only --quiet}
if {[info exists ocean]} { lappend cmd --ocean $ocean }
if {[info exists pirate]} { lappend cmd --pirate $pirate }
- manyset [split [eval exec $cmd] " "] ocean pirate
+ if {[catch {
+ manyset [split [eval exec $cmd] " "] ocean pirate
+ } emsg]} {
+ puts stderr "yarrg: [string trim $emsg]"
+ puts stderr "Alternatively pass, --ocean and perhaps --pirate options to where-vessels"
+ exit 1
+ }
if {![llength $ocean] || ![llength $pirate]} {
error "$ocean $pirate ?"
}
1 { report-set own "Other pirate's" }
2 { report-set own "Owner unknown" }
3 { report-set own "(All ownerships)" }
- 4 - 5 { report-set own "(Yours/unknown)" }
+ 4 - 5 { report-set own "(Not yours / unknown)" }
default { report-set own "?? $notown" }
}
}
proc smash-prepare {} {
global vc_codes smash_sizemap smash_size smash_sizeinexact
set mapto {}
- catch { unset smash_sizeplus }
+ catch { unset smash_sizeinexact }
foreach size $vc_codes {
if {!$smash_size($size)} {
set mapto $size
}
+#---------- info toplevel ----------
+
+proc info-toplevel-create {info title} {
+ toplevel $info
+ wm withdraw $info
+ wm title $info "where-vessels - $title"
+ wm protocol $info WM_DELETE_WINDOW [list wm withdraw $info]
+
+ button $info.close -text Close -command [list wm withdraw $info]
+ pack $info.close -side bottom
+}
+
#---------- parser error reporting ----------
proc parser-control-create {w base invokebuttontext etl_title} {
pack $w.resframe -side top -expand y -fill both
set eb .err_$base
- toplevel $eb
- wm withdraw $eb
- wm title $eb "where-vessels - $etl_title"
- wm protocol $eb WM_DELETE_WINDOW [list wm withdraw $eb]
+ info-toplevel-create $eb $etl_title
label $eb.title -text $etl_title
pack $eb.title -side top
- button $eb.close -text Close -command [list wm withdraw $eb]
- pack $eb.close -side bottom
-
frame $eb.emsg -bd 2 -relief groove
label $eb.emsg.lab -anchor nw -text "Error:"
text $eb.emsg.text -height 1