One of Tycho's goals is to make it easy to use Tycho itself as our development environment. To this end, we have incorporated interfaces to a few of the ``most useful'' development tools into Tycho. All of Tycho and Ptolemy is indexed by Glimpse [10], and this can be brought up from any Tycho window. We use SCCS revision control on all our sources, and so have a revision control dialog window that provides the most commonly-used commands, as well as the ability to regenerate any past history on demand. (Although we use SCCS, Tycho supports RCS equally well.) An off-line script processes every file in the documentation tree to produce various indexes of the documentation - every Tycho window can bring up viewers into these indexes to jump to needed documentation. A class browser (shown in figure 1) provides on overview of and access to every class in the system. Any text editor can bring up a spell-checking interface.
Tycho includes a number of syntax-sensitive text editors. We are not trying to duplicate the functionality of, say, emacs, but to provide a solid set of basic features which can work in concert with graphical interfaces and the integrated documentation system. Language-specific classes extend the basic editing facilities with support for compilation (C, C++ and Java), automatic documentation generation (Tcl and [incr Tcl]), and language-specific file, class, and function templates. Again, this is made possible by inheritance. Often, customizing functionality is simply a matter of inheriting from a suitable class and overriding one or two methods. For example, we have a shell that ``looks inside'' and monitors all activity with a model object (see section 4.1); this class inherits from the TclShell class and overrides just one method: evalCommand, which processes the text of an input command.
A great deal of Tycho's documentation is extracted from its source code. We use a similar scheme to Sun's Javadoc system [4], which extracts documentation from comments preceding class and method declarations, and uses special tags to distinguish different fields of the comment text. Text within comments is formatted in HTML, as is the generated documentation and indexes. All documentation can be viewed from within Tycho or using an external browser such a Netscape. In Tycho, anything can have a hyperlink to anything else - documentation to sources and vice versa; graphical editors to textual; and so on.
The Tycho HTML widget, based on Sun's HTML parsing library and shown in figure 1, has some enhancements that may be useful to other Tcl developers. First, the library relies on calls to unknown to handle unrecognized HTML tags. By defining all possible tags with null operations where necessary, HTML parsing sped up by a factor of three! Another performance problem was related to scoping in mega-widgets: we needed to create the text widget component at the global scope in order to prevent calls to unknown. Second, the HTML widget supports a tcl tag, which marks executable Tcl: any text so marked can be executed by double-clicking on it. This simple extension is surprisingly useful. For example, every class file contains a few lines of executable Tcl to demonstrate how the class may be used, which serves as both an example to a documentation reader and as a confidence check that documentation and code are up to date. We have taken this further where appropriate, and have written on-line tutorials for most of the user-interface support classes, which can be executed by reading and clicking.