Updated 2010-03-02 14:45:04 by LVwikignome

Purpose: to accumulate pointers to tools that Tcl developers find essential, or at least very useful, in the development of code using Tcl.

Writing Tcl edit

There are various kinds of development in Tcl. Different types of development may require different tools.

For instance, if the only type of coding in Tcl that you are doing is writing Tcl configuration scripts, you probably only need a text editor - that's all that a Tcl script is.

Any editor will do, from Unix standards ed and vi, to Windows' Notepage/Wordpad, to MacOS's simpletext. These editors tend to be quite limited with respect to Tcl specific functionality by default.

Is there a a decent tcl script for finding matching brackets?

Additional functionality (syntax highlighting or embedded Tcl interpreter which can be programmed for extended functionality) could be added as simply as selected one of the tools listed in Tcl editors (a group of editors either written in tcl or which have special features useful in editing tcl), or it could be gained by using a tool such as Emacs/Aquamacs/NTmacs, GNU nano, Kedit, nvi, pspad, TextPad, ScITE, vile, or vim.

After selecting a text editor, one often next finds that there is a wish for a tool to assist in building Tcl applications. For instance, often a developer from a Microsoft background asks about an IDE. There are a variety of options - however, it appears that there isn't any currently developing tool that provides as many features as the MS family of Visual Basic IDEs.

Those who work on a variety of languages sometimes recommend eclipse, emacs, or geany, because of the project management, source code management, syntax highlighting, etc. features. On MacOS X, Xcode has been mentioned as a useful development tool as well.

Komodo (esp. v2.0 +) is a nice, extensible IDE that works perfectly with Tcl/Tk, perl, and a variety of other open-source scripting languages. It has Tcl editing functionality unique among IDEs, like edit-time syntax checking. The professional version comes with a Tk GUI-builder.

Sometimes people just come asking about a tool to generate GUIs for them - that would allow them to drag and drop widgets onto a window and then generate code for that. There are a few tools like this in the Tcl community - tools like Visual Tcl, SpecTcl, and XF, as well as the just mentioned Komodo.

A decent difference/merge tool is also useful. tkdiff, eskil, or winmerge are three tools that are often used.

One obviously needs Tcl in some form. There are source and binary distributions available for many platforms [add in an appropriate wikit reference] (OS Distributions and Tcl Versions,). Some common distributions are the source distribution, ActiveTcl, and Tclkit (and other basekits) as well as others.

Depending on the distribution chosen, you may need some kind of unzip command, or tar and gunzip, or some other sort of package extraction tool, to get Tcl code out of a distribution. Then if you are dealing with a source distribution, you will need some tool to compile the source code. On Windows, people will often recommend environments like mks toolkit, msys/mingw, cygwin, UWIN, or Microsoft's SUA environment if the developer has need for tools like gnu c compiler (gcc), awk, bash/ksh/Bourne shell, autconf, make, etc.

Visual C++ and nmake have also been recommended.

KitCreator is a means to generate a tclkit-like executable.

If you are using an ActiveTcl 8.5 or newer distribution, check out teacup, which provides access to an ActiveState provided repository of binary versions of many Tcl compilable extensions.

Debugging edit

Next, people ask "what debugging tools are available to a Tcl programmer?" There are many techniques, ranging from simple puts commands added appropriately to visually oriented tools supporting breakpoints, etc. tkinspect is another useful debugging tool, as is is the Tcl Dev Kit or TclPro - a set of programs which provide not only static and dynamic debugging aids, but even a way to create a single distribution file that contain all the pieces one needs to execute a Tcl program. Frink is a tool that also provides static debugging assistance - it analyzes your application and determines whether there are style or API problems that should be fixed. RamDebugger is a graphical debugger/IDE. Again, Komodo also falls into this category.

A tool which complements various editor/IDEs is Lexient's Surveyor [1]. It provides a visual overview (call trees, impact analyses, metrics, etc.), flow charts, and html documentation. Useful for writing, reengineering, debugging or designing.

Another useful development tool is the TclX profiling commands, which provide analysis of how much time is being spent in Tcl procs.

A tool to display the flow of the script: Flow tracing.

A package to display the calling sequence for a proc: Pstack

If problems arise in the C portions of Tcl or extensions, then a C debugger, memory type checkers, and C static checkers (ala lint, etc.) are also recommended. If you are making use of threads, then you will likely need a debugger that can debug threads.

See tcl-golems as well.

Use of a virtualization environment such as VMware, or the free http://www.virtualbox.org/ allow one to set up an entire environment - perhaps even unique operating system - then perform testing with less impact on the machine itself.

If you are testing across various platforms, you might find Virtual Network Computing (VNC) (also known as remote control) helpful software, as it allows you to connect to other computers and interact with them as if you were sitting with with that software installed on your desktop.

Managing Source edit

One will often find it useful, and perhaps even critical, to manage the source code that one is writing in a source code management (SCM) system. tkcvs is one tool (and there are others - see http://www.purl.org/NET/Tcl-FAQ/part4.html for pointers to others) for interfacing with various SCMs. Many of the Tcl communities projects reside on SourceForge and their source controlled by CVS, so you may want to set that tool up just to access the source repositories. Subversion (SVN) is another popular environment for revision control.

TortoiseCVS/TortoiseSVN are a couple of tools which have been mentioned occasionally as useful in interacting with these SCM environments.

C-like include in tcl

Extensions edit

After writing and debugging Tcl scripts, one sometimes finds that they need functionality beyond that of the basic Tcl. That is where Tcl/Tk Extensions come into play. There are many pre-written extensions - this wiki has many pages dedicated to that topic.

To get one of these, one typically needs to either download an appropriate binary version of the extension (perhaps even via a Batteries Included type package which includes a large number of such functions) or at least the source code of the extensions.

Depending on the distribution chosen, you will likely need some sort of unzip command, or tar and gunzip, or some other sort of package extraction tool.

If source code is downloaded, this source code is as likely to be in a language such as C or C++ as it is to be in Tcl. See How to compile Tcl and C extensions for details. A different tool set is needed for creating Tcl extensions than is needed for creating Tcl scripts. Some extensions of this type are Tk, BLT, Tix, Tktable, tclodbc, etc.

For instance, one will likely need tools such as make, a c or c++ compiler, and possibly other tools.

If the extension downloaded is purely Tcl based (such as BWidget, tcllib, etc.), then one may be able to install the software with minimal additional tools.

Question: what tools are needed to support creating TEA extensions? Does one need the GNU autoconf program? Anything else?

Some Tcl development (Jacl or TclBlend for instance) may require you to have a Java development environment.

Reading the Reference Material edit

Reference material for Tcl and family typically comes in one of the following formats:

  • doctools style - this is the Tcl community preference, since with the doctools, one can generate several of the following formats from it
  • nroff man macro style - by far the most common. Requires some kind of tool to either format or to convert into another form
  • html files - a web browser can be used
  • plain text - use the text editor chosen above
  • PDF - Adobe Acrobat Reader is available on many platforms
  • Windows Help - this Windows format can only be read on other platforms with specialized tools.

Deployment edit

Finally, after one has written their application, there is a need for deployment. There are many ways to do this - from inventing one's own unique strategy, to using the typical install steps that the TEA standard recommends, to bundling the application up via Tcl Dev Kit's TclApp, TclPro's prowrap, freewrap, or even tclkit's sdx to createstarkit and starpack formats. There are, of course, other progarms which do similar types of bundling. You may, depending on the platform, need some other sort of package creation tool (to create .rpm, .deb, .zip, etc. files).