nscl_logo_small.gif (2463 bytes)

SpecTcl - User's Guide

HH00706_.wmf (6530 bytes)

SpecTcl Home  General Information User Guide Programmer's Guide Obtaining and Installing

This page covers the following information:

SpecTcl Concepts

SpectTcl is a data sorting program which uses an extended version of Tcl/TK as a command language. Using Tcl/Tk, a general purpose scripting language provides the user (and SpecTcl's developer(s)) with a powerful command language framework on which to base the system.  For more information on Tcl/Tk, click here.  For information about SpecTcl's extensions to Tcl/Tk, click here.

SpecTcl understands the following types of entities:

Power users of SpecTcl will have a thorough understanding of these concepts.

Top

Configuring SpecTcl's limits and default actions

SpecTcl uses the initial values of some Tcl global variables to set some hard and soft limits.  These limits are read in as follows:

  1. First the SpecTcl system configuration script is read from $INSTDIR/Etc/SpecTclInit.tcl   ($INSTDIR is the base of the SpecTcl installation tree).  This script is expected to contain system defaults for these variables.
  2. If SpecTclInit.tcl exists in the user's home directory, it too will be run to allow the system defaults to be overridden.
  3. Any variables which are not set by either of these scripts is defaulted to by hard coded values in AppInit.cpp.

The variables which may be modified are listed below:

Variable Name Usage "Normal Default"
DisplayMegabytes Number of megabytes of shared display spectrum memory to allocate.  This is a hard limit which is maintained for the duration of the program run. This value is in units of megabytes (1024*1024) e.g. 20 is 20 megabytes of storage. Hard coded:  16 (megabytes)
$INSTDIR/etc/SpecTclInit.tcl 16
ParameterCount Soft limit on number of parameters in an event. This sets the initial size of the parameter array.  The parameter array dynamically expands if necessary, however setting the ParameterCount at least as large as the number of parameters you will be creating reduces the per event overhead of maintaining that array. Hard coded: 256
$INSTDIR/etc/SpecTclInit.tcl 256
EventListSize Number of events which are accumulated in the event list before dumping the event list to the histogramming pipeline. Hard Coded:  256
$INSTDIR/etc/SpecTclInit.tcl 256
ParameterOverwriteAction Tells SpecTcl's parameter read script what to do when a parameter which already exists is read in.  This can be any of the following values:
  • skip - the old parameter is retained and the new definition is ignored.
  • overwrite - the new parameter definition silently replaces the old one
  • query - The user is asked whether or not to accept the new parameter definition or keep the old one.
query
SpectrumOverwriteAction Tells SpecTcl's spectrum read scripts what to do when a spectrum which is already defined is read in.  This can be any of the following values:
  • skip - the old parameter is retained and the new definition is ignored.
  • overwrite - the new parameter definition silently replaces the old one
  • query - The user is asked whether or not to accept the new parameter definition or keep the old one.

 

 

query
TKConsoleHistory
Sets the number of commands in the TK console history buffer.
48
TKConsoleBufferSize
Sets the number of characters in the TK console scroll back buffer.
512
NoPromptForNewGui If this variable is defined and is true, promting the user to try out the new tree parameter Gui will be disabled. Normally the user is asked to try the new GUI out if the old GUI is started. false
splashImage Provides the name of a file that contains an image type supported by Tcl. This image will be used in the splash screen generated in SpecTclRC.tcl. Note that it may be necessary to require packages to extend the image format capabilities. $SpecTclHome/doc/hh00706_.jpg (the SpecTcl logo - sunglasses).

These variables are set using the Tcl set command.  The following segment from a user's SpecTclInit.tcl script sets  the display storage to 20 megabytes and the initial parameter set to 1024:

set DisplayMegabytes 20		;# 20 Megabytes of display memory
set ParameterCount   1024       ;# 1K parametrers for this run.

 

Top

SpecTcl's Command Language

SpecTcl contains an embedded scripting language called Tcl/Tk.   Tcl, the "Tool Command Language" was developed by John K.  Ousterhout.  The Tk command set add on provides the ablility to create Graphical User interfaces based on Tcl/Tk.   The combination provides powerful scripting support for many applications.   Since Tcl/Tk is actually a library, programs like SpecTcl can add the power of Tcl/Tk to their user interface.  For example, the following Tcl/Tk script analyzes a 10 second shot of data:

start		    	;# Start analyzing data.
after 10000 stop 	;# After 10000milliseconds issue the stop command.

To give a more interesting example of Tcl/Tk in action: The following Tcl Script, adds a command named Help which brings up Netscape displaying the home page of the SpecTcl documentation, it then creates a button labelled Help which will trigger this command and adds it to the GUI:

proc Help {} {                      ;#Help command
    global SpecTclHome              ;# This variable "knows" where SpecTcl was installed 
    set URL [format "%s%s" $SpecTclHome /doc/index.htm]  ;# Constructs the Doc. URL.
    exec netscape $URL &            ;# Spins off Netscape as a background process.
}
button .help      -text "Help"  -command Help   ;# Creates the Help button and
pack   .help                                    ;# Packs it into the main window.

It is beyond the scope of this page to provide a complete description of the Tcl/TK command language, The following two books are useful resources:

Tcl and the Tk Toolkit John K. Ousterhout Addison Wesley ISBN 0-201-63337-X

Practical Programming in Tcl and Tk   Brent B. Welch Prentice Hall ISBN 0-13-6t16830-2

The following links point to some online resources for Tcl/Tk:

TCL/WWW info
Starting page for Tcl/Tk info (english/german)
Manual pages for Tcl/TK
The Tcl exchange

Top

Initialization

SpecTcl's graphical user interface is built on TK. It is therefore possible for you to define your own extensions to the GUI. In addition, other user level initializations may, from time to time, be useful, such as ensuring that various procedures are defined. SpecTcl therefore will run the file: ~/SpecTclRC.tcl if it exists after it has initialized.

Top

SpecTcl Home  General Information User Guide Programmer's Guide Obtaining and Installing


Last Modified: October 28, 2003 by: fox@nscl.msu.edu
© Copyright NSCL 1999, All rights reserved