next up previous contents index
Next: Syntax Up: Course Manual Spoken Language Previous: IPAWorldbet and OGIbet

A Primer on Tcl

The Tool Command Language, Tcl, is a full-fledged programming language. It assigns! It decides! It loops...and so much more. Tcl is the brain child of John K. Ousterhout from UC Berkeley. It is an interpretted, rather than a compiled language. This means that your code may contain lethal, core dumping bugs of which the Tcl interpretter may never be aware, so long as the program's flow control logic avoids that section of the script.

The Tcl interpretter parses and executes your commands sequentially, starting with the first one you entered (either in the interactive shell or in a script).

You may hear Tk mentioned in the same breath as Tcl. Tk is a toolkit of commands that allows you to build graphical user interfaces. In fact much of CSLUrp is created using Tk. However, for the purposes of this course, we will focus on Tcl.

CSLUrp provides several places to insert Tcl code. Many of the states have both the pre and post actions. Tcl code can be inserted in any Action box.

In this section, you will learn basic programming skills in Tcl. We quickly cover programming fundamentals. We assume that you know when and why these concepts are valuable in programming, so we focus on showing you how and what to do.

The discussion is somewhat simplified. Some details will be omitted or even lied about (in relatively harmless ways). Please consult the Tcl manual, ``Tcl and the Tk Toolkit,'' by John  K. Ousterhout  or the on-line manual pages for Tcl for the truth. A local version of the on-line help is available at http:// www.cse.ogi.edu/CSLU

  1. Start the Tcl shell, and work through as many of the following examples as time allows.

    To start the Tcl shell in WINDOWS, click Start -> Programs -> CSLU Speech Toolkit -> Tclsh. A new console window just for the tclsh will be started. If all goes well your prompt sign should change to %.

      In WINDOWS, if you would like to resize the tclsh console or add either vertical or horizonital sliders ...so that text that scrolls off the screen will not be permanently lost and gone, right-click on the title-bar of the console window to drop-down a menu form from which you should select Properties....

    In the Properties dialogue box select the Layout tab. Change the Width entry in the Screen Buffer Size area to 200 (or more if you like--this will determine the maximum character-width to which you can re-size this type of console window). Then change the Height entry in the Screen Buffer Size area to 3000 (or more if you like--this will be the maximum number of lines held in the buffer of the vertical scroll-bar). Click on OK and then choose Save properties for future windows with same title and click OK again. You should now see vertical and horizontal scroll-bars whenever your tclsh console window is open.

 To exit the tclsh type exit or press Ctrl-C.

The following sections highlight many basic Tcl commands. The indented text may be entered directly into the Tcl shell.



next up previous contents index
Next: Syntax Up: Course Manual Spoken Language Previous: IPAWorldbet and OGIbet

Ed Kaiser
Fri Sep 26 18:41:18 PDT 1997