1#! /bin/sh 2# \ 3 exec wish $0 ${1+"$@"} 4# BEGIN LICENSE BLOCK 5# Version: CMPL 1.1 6# 7# The contents of this file are subject to the Cisco-style Mozilla Public 8# License Version 1.1 (the "License"); you may not use this file except 9# in compliance with the License. You may obtain a copy of the License 10# at www.eclipse-clp.org/license. 11# 12# Software distributed under the License is distributed on an "AS IS" 13# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 14# the License for the specific language governing rights and limitations 15# under the License. 16# 17# The Original Code is The ECLiPSe Constraint Logic Programming System. 18# The Initial Developer of the Original Code is Cisco Systems, Inc. 19# Portions created by the Initial Developer are 20# Copyright (C) 2006 Cisco Systems, Inc. All Rights Reserved. 21# 22# Contributor(s): 23# 24# END LICENSE BLOCK 25 26set ppid [lindex $argv 0] 27set type [lindex $argv 1] 28set port [lindex $argv 2] 29set abort_channel [socket localhost $port] 30fileevent $abort_channel readable "abort_state_handler $abort_channel" 31 32proc abort_state_handler {abort_channel} { 33 global type 34 35 if [eof $abort_channel] { 36 ;# eof if tkeclipse has quit; kill the abort button as well 37 catch {close $abort_channel} 38 exit 39 } 40 gets $abort_channel state 41 42 switch $state { 43 disable { 44 .abort configure -state disabled 45 } 46 activate { 47 .abort configure -state normal 48 if {$type == "standalone"} { 49 ;# raise the window 50 wm deiconify . 51 raise . 52 } 53 } 54 } 55} 56 57 58button .abort -text interrupt -command "exec kill -2 $ppid" 59 60# emergency exit :-) 61bind .abort <Shift-Control-Button-1> "exec kill -9 $ppid; exit" 62 63pack .abort -side left -expand 1 -fill x 64