This chapter addresses communication
between
Source-Navigator and external
applications, and provides examples of how to control Source-Navigator
from other applications.
These examples use the Source-Navigator
Tcl interpreter called
hyper. To use the standard Tcl/Tk interpreter,
replace the
.../snavigator/bin/hyper string with the appropriate
name; for example
/usr/local/bin/wish.
After an external application
connects to a Source-Navigator project, it may be controlled remotely using
the Tk
send command.
The communication between
external applications and Source-Navigator can be achieved using the Tk
send
command. Communicating with
Source-Navigator
from another application requires that the application know the name of
the interpreter running Source-Navigator. The Tk command
winfo interps
is useful for determining the name of all the interpreters active on a
host.
Further information on the
Tk
send command can be found in one of the Tcl/Tk texts mentioned
in the introduction.
An application may need to
query every Source-Navigator
interpreter
name in the network. The example below queries every Source-Navigator interpreter
name and fetches the name of the Source-Navigator projects. Then if the
string
c++_demo is found, the project name reloads files specified
in the command line.
If the script above is executable
and the path to the interpreter is correct, the script will reparse and
reload all files specified on the command line. If a listed file is being
edited in a Source-Navigator editor window, the contents of the editor
window will be updated.
|
File names have to be used relative to
the project root directory if the file is in a subdirectory of the project;
otherwise, the file names must be specified with absolute path names (
./
and ../ cannot be used in file names). |