Create New Tcl Commands

The Tcl interface allows you to manipulate the trace using Tcl scripts. This chapter covers the basics about writing Tcl scripts and executing them in VOV. In fact, most VOV commands such as vsr and vovforget are implemented by means of Tcl scripts.

Tcl Interpreters with VOV Extensions

Many VOV tools contain a Tcl interpreter.
  • For interactive use, choose Tools > Tcl Interpreter in the Console.
  • For batch processing you can choose between vovbuild and vovsh. The two tools differ in their behavior after the script has been executed.
    Use vovbuild with the -f option. After the script has completed, vovbuild exits.
    % vovbuild -f <tclScript>
    Use vovsh with the -f option. After the script has completed, vovsh enters a loop to manage the user interface and exits when the top level window of the user interface is dismissed. If no window is created by the script, vovsh exits immediately.
    % vovsh -f <tclScript>
The packages Tk and Tix are available in these interpreters, but for performance reasons they are disabled by default and they need to be activated explicitly calling vovClientInit. For example:
vovClientInit tk ; # Initialize Tk.
vovClientInit tix; # Initialize Tk and Tix.
vovClientInit all; # Initialize all packages, i.e. Tk and Tix.

These interpreters also have access to all the VOV extensions, that is all the "vtk" procedures. For more information on the vtk procedures, refer to the VOV/Tcl Interface section in the VOV Reference Guide.

Tcl Intepreters without VOV Extensions

The VOV distribution contains two other Tcl interpreters which are already familiar to those using Tcl. One is vtclsh, which is the VOV version of tclsh. The differences between tclsh and vtclsh are :
  • we use a different name to avoid conflicts with other versions of tclsh;
  • vtclsh is instrumented with VIL, the VOV Instrumentation Library;
  • by default, vtclsh uses the libraries included in the VOV distribution.

The other interpreter is wish, which differs from the original only because it is an instrumented tool.

Many scripts in the VOV distribution use vtclsh.

You can invoke these interpreters with the proper options as illustrated below:
% vtclsh <script>
% wish -f <script>