+proc for_ll {varname body} {
+ upvar 1 $varname l
+ foreach l {times pirates messages} {
+ set rc [catch { uplevel 1 $body } emsg]
+ switch -exact $rc {
+ 0 {
+ # ok
+ }
+ 4 {
+ # continue
+ }
+ 3 {
+ # break
+ return
+ }
+ default {
+ # error, return, etc.
+ return -code $rc -errorinfo $errorInfo \
+ -errorcode $errorCode $emsg
+ }
+ }
+ }
+}
+
+proc retint {} {
+ global messages
+ set i 0
+ set now [clock seconds]
+ foreach minfo $messages {
+ manyset $minfo then pirate msg
+ set !
+}
+
+proc init {} {
+ global currentfile height
+ global times pirates messages
+ set currentfile {}
+
+ foreach w {t p m} { .$w delete 0 end }
+ foreach l {times pirates messages}
+ for {set i 0} {$i<$height} {incr i} {
+ lappend times 0
+ lappend pirates {}
+ lappend messages {}
+ foreach w {t p m} { .$w insert end {} }
+ }
+}