The second half of the interface is a C++ program that is controlled by the Tk part. The C++ program is responsible for reading and writing files, and for any substantial amount of arithmetic.
The division into two pieces is not mandatory, but has proven to be more efficient than other alternatives. In particular, although Tk widgets are generally very efficient (they are coded in C), some computations are slow; in particular, arithmetic is not fast, since Tcl converts all numbers from and to strings.
Tcl and Tk provide a remarkably flexible and effective tool for building interfaces; it has been possible to perform myriad experiments with the look and feel of the interface in response to suggestions and criticisms by users. It appears that development of interfaces with Tcl/Tk is at least an order of magnitude faster than with code written in C or C++, even with good libraries and other aids. The code is also relatively compact; for months the interface had less than 500 lines of Tcl and about 250 lines of AWK. The current version has 2450 lines of Tcl and 1200 lines of C++. There is also a separate program of about 1350 lines of C++ for the perspective view.
Previous Beginning Next