source: trunk/gui/apps/launcher.tcl @ 2144

Last change on this file since 2144 was 2144, checked in by gah, 13 years ago

vtk-contour-viewer additions: still experimental

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1#!/bin/sh
2# ----------------------------------------------------------------------
3#  RAPPTURE LAUNCHER
4#
5#  This script is invoked by the "rappture" command.  It parses
6#  various input options and selects the proper main program to
7#  run depending on the function (build tool, run tool, tester, etc.).
8#
9#  RUN AS FOLLOWS:
10#    rappture ?-run? ?-tool <toolfile>?
11#    rappture -builder ?-tool <toolfile>?
12#    rappture -tester ?-tool <toolfile>? ?-testdir <directory>?
13#
14#  The default option is "-run", which brings up the GUI used to
15#  run the tool.  If the <toolfile> is not specified, it defaults
16#  to "tool.xml" in the current working directory.
17#
18# ======================================================================
19#  AUTHOR:  Michael McLennan, Purdue University
20#  Copyright (c) 2004-2011  Purdue Research Foundation
21#
22#  See the file "license.terms" for information on usage and
23#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
24# ======================================================================
25package require RapptureGUI
26set guidir $RapptureGUI::library
27
28package require RapptureBuilder
29set blddir $RapptureBuilder::library
30
31package require RapptureTester
32set testdir $RapptureTester::library
33
34set mainscript [file join $guidir scripts main.tcl]
35set alist ""
36set toolxml ""
37
38# scan through the arguments and look for the function
39while {[llength $argv] > 0} {
40    set opt [lindex $argv 0]
41    set argv [lrange $argv 1 end]
42
43    if {[string index $opt 0] == "-"} {
44        switch -- $opt {
45            -run {
46                set mainscript [file join $guidir scripts main.tcl]
47            }
48            -builder {
49                set mainscript [file join $blddir scripts main.tcl]
50            }
51            -tester {
52                set mainscript [file join $testdir scripts main.tcl]
53            }
54            -tool {
55                set toolxml [lindex $argv 0]
56                set argv [lrange $argv 1 end]
57                if {![file exists $toolxml]} {
58                    puts stderr "file not found: $toolxml"
59                    exit 1
60                }
61                lappend alist -tool $toolxml
62            }
63            -tool - -testdir - -nosim {
64                lappend alist $opt [lindex $argv 0]
65                set argv [lrange $argv 1 end]
66            }
67            -load {
68                lappend alist $opt
69                while { [llength $argv] > 0 } {
70                    set val [lindex $argv 0]
71                    if { [string index $val 0] == "-" } {
72                        break
73                    }
74                    lappend alist $val
75                    set argv [lrange $argv 1 end]
76                }
77            }
78            default {
79                puts stderr "usage:"
80                puts stderr "  rappture ?-run? ?-tool toolFile? ?-nosim 0/1? ?-load file file ...?"
81                puts stderr "  rappture -builder ?-tool toolFile?"
82                puts stderr "  rappture -tester ?-tool toolFile? ?-testdir directory?"
83                exit 1
84            }
85        }
86    }
87}
88
89# Invoke the main program with the args
90
91# Note: We're sourcing the driver file "main.tcl" rather than exec-ing
92#       wish because we want to see stderr and stdout messages when they
93#       are written, rather than when the program completes.  It also
94#       eliminates one process waiting for the other to complete. If
95#       "exec" is needed, then the following could be replaced with
96#       blt::bgexec.  It doesn't try to redirect stderr into a file.
97set argv $alist
98package require Tk
99source  $mainscript
Note: See TracBrowser for help on using the repository browser.