1#! /bin/sh
2# \
3	exec wish $0 ${1+"$@"}
4
5# BEGIN LICENSE BLOCK
6# Version: CMPL 1.1
7#
8# The contents of this file are subject to the Cisco-style Mozilla Public
9# License Version 1.1 (the "License"); you may not use this file except
10# in compliance with the License.  You may obtain a copy of the License
11# at www.eclipse-clp.org/license.
12#
13# Software distributed under the License is distributed on an "AS IS"
14# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
15# the License for the specific language governing rights and limitations
16# under the License.
17#
18# The Original Code is  The ECLiPSe Constraint Logic Programming System.
19# The Initial Developer of the Original Code is  Cisco Systems, Inc.
20# Portions created by the Initial Developer are
21# Copyright (C) 2006 Cisco Systems, Inc.  All Rights Reserved.
22#
23# Contributor(s):
24#
25# END LICENSE BLOCK
26#----------------------------------------------------------------------
27# Preamble: Find and load the eclipse package
28#----------------------------------------------------------------------
29
30switch $tcl_platform(platform) {
31    unix {
32	if {![info exists env(ECLIPSEDIR)]} {
33	    puts "Cannot run Eclipse: ECLIPSEDIR environment variable is undefined."
34	    exit -1
35	}
36	set tkecl(ECLIPSEDIR) $env(ECLIPSEDIR)
37    }
38    windows {
39	package require registry
40	set tkecl(ECLIPSEDIR) [registry get \
41	    HKEY_LOCAL_MACHINE\\SOFTWARE\\IC-Parc\\Eclipse\\6.2 ECLIPSEDIR]
42    }
43    default {
44	error "$tcl_platform(platform) not supported"
45	exit
46    }
47}
48
49lappend auto_path [file join $tkecl(ECLIPSEDIR) lib_tcl]
50
51package require eclipse
52
53
54
55#----------------------------------------------------------------------
56# Make a standard menu bar and a 'file' menu
57#----------------------------------------------------------------------
58
59wm title . "The smallest possible ECLiPSe/Tcl/Tk Application"
60
61. config -menu .mbar
62
63menu .mbar
64.mbar add cascade -label File -menu .mbar.file
65
66menu .mbar.file
67.mbar.file add command -label Run -command run_eclipse
68.mbar.file add command -label Exit -command exit
69
70
71#----------------------------------------------------------------------
72# The command to run the Eclipse-goal
73#----------------------------------------------------------------------
74
75proc run_eclipse {} {
76    ec_post_goal { writeln("hello world"),flush(output) }
77    ec_resume
78}
79
80
81#----------------------------------------------------------------------
82# Initialise the embedded ECLiPSe
83#----------------------------------------------------------------------
84
85ec_init
86# allow ECLiPSe engine to shutdown when exiting
87bind . <Destroy> {ec_cleanup}
88