added --(a)ddress and --(p)ort arguments to core-gui command-line
added save/close buttons to plugins dialog updated man page/documentation with new arguments (Boeing r1816)
This commit is contained in:
parent
f2d1b6a553
commit
ca332bd83a
6 changed files with 74 additions and 94 deletions
|
@ -4,7 +4,7 @@
|
||||||
core-gui \- Common Open Research Emulator (CORE) graphical user interface
|
core-gui \- Common Open Research Emulator (CORE) graphical user interface
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B core-gui
|
.B core-gui
|
||||||
[\fI-h|-v\fR] [\fI-b|-c <sessionid>\fR] [\fI-s\fR] [\fI<configfile.imn>\fR]
|
[\fI-h|-v\fR] [\fI-b|-c <sessionid>\fR] [\fI-s\fR] [\fI-a address\fR] [\fI-p port\fR] [\fI<configfile.imn>\fR]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Launches the CORE Tcl/Tk X11 GUI or starts an imn\-based emulation.
|
Launches the CORE Tcl/Tk X11 GUI or starts an imn\-based emulation.
|
||||||
.TP
|
.TP
|
||||||
|
@ -23,6 +23,12 @@ stop and clean up a batch mode session <sessionid>
|
||||||
\-(\fB\-s\fR)tart
|
\-(\fB\-s\fR)tart
|
||||||
start in execute mode, not edit mode
|
start in execute mode, not edit mode
|
||||||
.TP
|
.TP
|
||||||
|
\-(\fB\-a\fR)ddress
|
||||||
|
connect to the specified IP address (default 127.0.0.1)
|
||||||
|
.TP
|
||||||
|
\-(\fB\-p\fR)ort
|
||||||
|
connect to the specified TCP port (default 4038)
|
||||||
|
.TP
|
||||||
<configfile.imn>
|
<configfile.imn>
|
||||||
(optional) load the specified imn scenario file
|
(optional) load the specified imn scenario file
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -88,6 +88,13 @@ The session number is printed in the terminal when batch mode is started. This s
|
||||||
The GUI can be run as a normal user on Linux. For FreeBSD, the GUI should be run
|
The GUI can be run as a normal user on Linux. For FreeBSD, the GUI should be run
|
||||||
as root in order to start an emulation.
|
as root in order to start an emulation.
|
||||||
|
|
||||||
|
.. index:: port number
|
||||||
|
|
||||||
|
The GUI can be connected to a different address or TCP port using
|
||||||
|
the ``--address`` and/or ``--port`` options. The defaults are shown below.
|
||||||
|
::
|
||||||
|
core-gui --address 127.0.0.1 --port 4038
|
||||||
|
|
||||||
.. _Toolbar:
|
.. _Toolbar:
|
||||||
|
|
||||||
Toolbar
|
Toolbar
|
||||||
|
|
|
@ -34,16 +34,19 @@
|
||||||
case $1 in
|
case $1 in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
echo ""
|
echo ""
|
||||||
echo "Usage: `basename $0` [-h|-v] [-b|-c <sessionid>] [-s] [<configfile.imn>]"
|
echo "Usage: `basename $0` [-h|-v] [-b|-c <sessionid>] [-s] [-a address] [-p port]"
|
||||||
|
echo " [<configfile.imn>]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Launches the CORE Tcl/Tk X11 GUI or starts an imn-based emulation."
|
echo "Launches the CORE Tcl/Tk X11 GUI or starts an imn-based emulation."
|
||||||
echo ""
|
echo ""
|
||||||
echo " -(-h)elp show help message and exit"
|
echo " -(-h)elp show help message and exit"
|
||||||
echo " -(-v)ersion show version number and exit"
|
echo " -(-v)ersion show version number and exit"
|
||||||
echo " -(-b)atch batch mode (no X11 GUI)"
|
echo " -(-b)atch batch mode (no X11 GUI)"
|
||||||
echo -n " -(-c)losebatch <sessionid> stop and clean up a batch mode "
|
echo -n " -(-c)losebatch <sessionid> stop and clean up a batch mode "
|
||||||
echo "session <sessionid>"
|
echo "session <sessionid>"
|
||||||
echo " -(-s)tart start in execute mode, not edit mode"
|
echo " -(-s)tart start in execute mode, not edit mode"
|
||||||
|
echo " -(-a)ddress connect to the specified IP address (default 127.0.0.1)"
|
||||||
|
echo " -(-p)port connect to the specified TCP port (default 4038)"
|
||||||
echo " <configfile.imn> (optional) load the specified imn scenario file"
|
echo " <configfile.imn> (optional) load the specified imn scenario file"
|
||||||
echo ""
|
echo ""
|
||||||
echo "With no parameters, starts the GUI in edit mode with a blank canvas."
|
echo "With no parameters, starts the GUI in edit mode with a blank canvas."
|
||||||
|
@ -154,10 +157,19 @@ case $1 in
|
||||||
exec ${TCLBIN} $core "$@"
|
exec ${TCLBIN} $core "$@"
|
||||||
;;
|
;;
|
||||||
-s)
|
-s)
|
||||||
exec ${WISH} $core "--start $@"
|
shift
|
||||||
|
exec ${WISH} $core -- "--start" "$@"
|
||||||
|
;;
|
||||||
|
-a)
|
||||||
|
shift
|
||||||
|
exec ${WISH} $core -- "--address" "$@"
|
||||||
|
;;
|
||||||
|
-p)
|
||||||
|
shift
|
||||||
|
exec ${WISH} $core -- "--port" "$@"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exec ${WISH} $core $@
|
exec ${WISH} $core -- $@
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
86
gui/core.tcl
86
gui/core.tcl
|
@ -31,49 +31,19 @@
|
||||||
# and Technology through the research contract #IP-2003-143.
|
# and Technology through the research contract #IP-2003-143.
|
||||||
#
|
#
|
||||||
|
|
||||||
#****h* imunes/imunes.tcl
|
|
||||||
# NAME
|
|
||||||
# imunes.tcl
|
|
||||||
# FUNCTION
|
|
||||||
# Starts imunes in batch or interactive mode. Include procedures from
|
|
||||||
# external files and initializes global variables.
|
|
||||||
#
|
|
||||||
# imunes [-b|--batch] [filename]
|
|
||||||
#
|
|
||||||
# When starting the program in batch mode the option -b or --batch must
|
|
||||||
# be specified.
|
|
||||||
#
|
|
||||||
# When starting the program with defined filename, configuration for
|
|
||||||
# file "filename" is loaded to imunes.
|
|
||||||
#****
|
|
||||||
|
|
||||||
if {[lindex $argv 0] == "-b" || [lindex $argv 0] == "--batch"} {
|
if {[lindex $argv 0] == "-b" || [lindex $argv 0] == "--batch"} {
|
||||||
set argv [lrange $argv 1 end]
|
set argv [lrange $argv 1 end]
|
||||||
set execMode batch
|
set execMode batch
|
||||||
} elseif {[lindex $argv 0] == "-c" || [lindex $argv 0] == "--closebatch"} {
|
} elseif {[lindex $argv 0] == "-c" || [lindex $argv 0] == "--closebatch"} {
|
||||||
set argv [lrange $argv 1 end]
|
set argv [lrange $argv 1 end]
|
||||||
set execMode closebatch
|
set execMode closebatch
|
||||||
} elseif {[lindex $argv 0] == "-a" || [lindex $argv 0] == "--addons"} {
|
} elseif {[lindex $argv 0] == "--addons"} {
|
||||||
set argv [lrange $argv 1 end]
|
set argv [lrange $argv 1 end]
|
||||||
set execMode addons
|
set execMode addons
|
||||||
} else {
|
} else {
|
||||||
set execMode interactive
|
set execMode interactive
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Include procedure definitions from external files. There must be
|
|
||||||
# some better way to accomplish the same goal, but that's how we do it
|
|
||||||
# for the moment.
|
|
||||||
#
|
|
||||||
|
|
||||||
#****v* imunes.tcl/LIBDIR
|
|
||||||
# NAME
|
|
||||||
# LIBDIR
|
|
||||||
# FUNCTION
|
|
||||||
# The location of imunes library files. The LIBDIR variable
|
|
||||||
# will be automatically set to the proper value by the installation script.
|
|
||||||
#*****
|
|
||||||
|
|
||||||
set LIBDIR ""
|
set LIBDIR ""
|
||||||
set SBINDIR "/usr/local/sbin"
|
set SBINDIR "/usr/local/sbin"
|
||||||
set CONFDIR "."
|
set CONFDIR "."
|
||||||
|
@ -136,61 +106,12 @@ source "$LIBDIR/exceptions.tcl"
|
||||||
#
|
#
|
||||||
# Global variables are initialized here
|
# Global variables are initialized here
|
||||||
#
|
#
|
||||||
|
|
||||||
#****v* imunes.tcl/node_list
|
|
||||||
# NAME
|
|
||||||
# node_list
|
|
||||||
# FUNCTION
|
|
||||||
# Represents the list of all the nodes in the simulation. When starting
|
|
||||||
# the program this list is empty.
|
|
||||||
#*****
|
|
||||||
|
|
||||||
#****v* imunes.tcl/link_list
|
|
||||||
# NAME
|
|
||||||
# link_list
|
|
||||||
# FUNCTION
|
|
||||||
# Represents the list of all the links in the simulation. When starting
|
|
||||||
# the program this list is empty.
|
|
||||||
#*****
|
|
||||||
|
|
||||||
#****v* imunes.tcl/canvas_list
|
|
||||||
# NAME
|
|
||||||
# canvas_list
|
|
||||||
# FUNCTION
|
|
||||||
# Contains the list of all the canvases in the simulation. When starting
|
|
||||||
# the program this list is empty.
|
|
||||||
#*****
|
|
||||||
|
|
||||||
#****v* imunes.tcl/prefs
|
|
||||||
# NAME
|
|
||||||
# prefs
|
|
||||||
# FUNCTION
|
|
||||||
# Contains the list of preferences. When starting a program
|
|
||||||
# this list is empty.
|
|
||||||
#*****
|
|
||||||
|
|
||||||
#****v* imunes.tcl/eid
|
|
||||||
# NAME
|
|
||||||
# eid -- experiment id.
|
|
||||||
# FUNCTION
|
|
||||||
# The id of the current experiment. When starting a program this variable
|
|
||||||
# is set to e0.
|
|
||||||
#*****
|
|
||||||
|
|
||||||
set node_list {}
|
set node_list {}
|
||||||
set link_list {}
|
set link_list {}
|
||||||
set annotation_list {}
|
set annotation_list {}
|
||||||
set canvas_list {}
|
set canvas_list {}
|
||||||
set eid e0
|
set eid e0
|
||||||
set plot_list {}
|
set plot_list {}
|
||||||
|
|
||||||
#****v* core.tcl/exec_servers
|
|
||||||
# NAME
|
|
||||||
# exec_servers -- array of CORE remote execution servers
|
|
||||||
# FUNCTION
|
|
||||||
#*****
|
|
||||||
|
|
||||||
# IP port monitor_port active ssh username
|
|
||||||
array set exec_servers {}
|
array set exec_servers {}
|
||||||
loadServersConf ;# populate exec_servers
|
loadServersConf ;# populate exec_servers
|
||||||
|
|
||||||
|
@ -202,6 +123,7 @@ set g_mrulist {}
|
||||||
initDefaultPrefs
|
initDefaultPrefs
|
||||||
loadDotFile
|
loadDotFile
|
||||||
loadPluginsConf
|
loadPluginsConf
|
||||||
|
checkCommandLineAddressPort
|
||||||
autoConnectPlugins
|
autoConnectPlugins
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,12 +147,10 @@ if {$execMode == "interactive"} {
|
||||||
puts " $e"
|
puts " $e"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# end Boeing
|
|
||||||
setOperMode edit
|
setOperMode edit
|
||||||
fileOpenStartUp
|
fileOpenStartUp
|
||||||
# Boeing --start option
|
|
||||||
foreach arg $argv {
|
foreach arg $argv {
|
||||||
if { $arg == "--start -s" || $arg == "--start" } {
|
if { $arg == "--start" } {
|
||||||
global currentFile
|
global currentFile
|
||||||
if { [file extension $currentFile] == ".xml" } {
|
if { [file extension $currentFile] == ".xml" } {
|
||||||
after 100; update; # yield to other events so XML file
|
after 100; update; # yield to other events so XML file
|
||||||
|
|
|
@ -261,8 +261,7 @@ proc fileOpenStartUp {} {
|
||||||
|
|
||||||
# Boeing
|
# Boeing
|
||||||
foreach arg $argv {
|
foreach arg $argv {
|
||||||
if { $arg != "" && $arg != "--start -s" && $arg != "--start" && \
|
if { $arg != "" && $arg != "--start" && $arg != "--batch" } {
|
||||||
$arg != "--batch -b" && $arg != "--batch" } {
|
|
||||||
set currentFile [argAbsPathname $arg]
|
set currentFile [argAbsPathname $arg]
|
||||||
openFile
|
openFile
|
||||||
break
|
break
|
||||||
|
|
|
@ -120,8 +120,9 @@ proc popupPluginsConfig {} {
|
||||||
|
|
||||||
# close button
|
# close button
|
||||||
frame $wi.b -borderwidth 0
|
frame $wi.b -borderwidth 0
|
||||||
button $wi.b.cancel -text "Close" -command "writePluginsConf; destroy $wi"
|
button $wi.b.save -text "Save" -command "writePluginsConf; destroy $wi"
|
||||||
pack $wi.b.cancel -side right
|
button $wi.b.cancel -text "Cancel" -command "destroy $wi"
|
||||||
|
pack $wi.b.cancel $wi.b.save -side right
|
||||||
pack $wi.b -side bottom
|
pack $wi.b -side bottom
|
||||||
|
|
||||||
# uncomment to make modal
|
# uncomment to make modal
|
||||||
|
@ -1230,6 +1231,7 @@ proc pluginConnect { name cmd retry } {
|
||||||
# connect, disconnect, or do nothing
|
# connect, disconnect, or do nothing
|
||||||
if { $cmd == "connect" && $snum != 1} {
|
if { $cmd == "connect" && $snum != 1} {
|
||||||
puts -nonewline "Connecting to $name ($ip:$port)..."
|
puts -nonewline "Connecting to $name ($ip:$port)..."
|
||||||
|
flush stdout
|
||||||
set sock [openAPIChannel $ip $port $retry]
|
set sock [openAPIChannel $ip $port $retry]
|
||||||
if { "$sock" <= -1 } { return -1 };# user pressed cancel
|
if { "$sock" <= -1 } { return -1 };# user pressed cancel
|
||||||
set snum 1 ;# status connected
|
set snum 1 ;# status connected
|
||||||
|
@ -1561,3 +1563,37 @@ proc listToKeyValues { keyvalues } {
|
||||||
return $r
|
return $r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# parse command-line parameters for address/port to connect with
|
||||||
|
proc checkCommandLineAddressPort {} {
|
||||||
|
global argv g_plugins
|
||||||
|
set addr ""; set port ""
|
||||||
|
set addri [lsearch -regexp $argv "(^\[-\]\[-\]address$|^\[-\]a$)"]
|
||||||
|
#set addri [lsearch -exact $argv "--address"]
|
||||||
|
if { $addri > -1 } {
|
||||||
|
set argv [lreplace $argv $addri $addri]
|
||||||
|
set addr [lindex $argv $addri]
|
||||||
|
if { ![checkIPv4Addr $addr] } {
|
||||||
|
puts "error: invalid address '$addr'"; exit;
|
||||||
|
}
|
||||||
|
set argv [lreplace $argv $addri $addri]
|
||||||
|
}
|
||||||
|
|
||||||
|
#set porti [lsearch -exact $argv "--port"]
|
||||||
|
set porti [lsearch -regexp $argv "(^\[-\]\[-\]port$|^\[-\]p$)"]
|
||||||
|
if { $porti > -1 } {
|
||||||
|
set argv [lreplace $argv $porti $porti]
|
||||||
|
set port [lindex $argv $porti]
|
||||||
|
if { $port == "" || ![string is integer $port] || $port > 65535 } {
|
||||||
|
puts "error: invalid port '$port'"; exit;
|
||||||
|
}
|
||||||
|
set argv [lreplace $argv $porti $porti]
|
||||||
|
}
|
||||||
|
# update the auto-connect plugin (core-daemon entry)
|
||||||
|
if { $addri > -1 || $porti > -1 } {
|
||||||
|
set key [lindex [getEmulPlugin "*"] 0]
|
||||||
|
set plugin_data $g_plugins($key)
|
||||||
|
if { $addri > -1 } { set plugin_data [lreplace $plugin_data 0 0 $addr] }
|
||||||
|
if { $porti > -1 } { set plugin_data [lreplace $plugin_data 1 1 $port] }
|
||||||
|
array set g_plugins [list $key $plugin_data]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue