next up previous
Next: Commands Up: Interactive Scripting Language Previous: Interactive Scripting Language

Implementation

Extending the Tcl interpreter is well documented in Part III of J.Ousterhout's book ``Tcl and the Tk Toolkit''.

The main feature of Tcl is the interpreter. Each Tcl command is implemented as a function in C. Commands should be atomic primitives which offer the smallest level of functionality required by the user but not less. Implementing too low a level of functionality makes script writing wieldy, whereas too high a level means too many commands have to be implemented.

When implementing new commands in Tcl a choice must be made between action-oriented and object-oriented. Actions i.e. commands, are useful when implementing single actions which do not create data structures which have to be maintained. Objects are useful when it is necessary to maintain data structures over longer periods of times and refer to the contents of the data structure. Most of the NCCS commands will be action-oriented. Where it makes sense to implement objects (e.g. maybe in the case of a scan) it should be done because objects offer a better description of the real-world than actions.

Input and output parameters will be passed the usual way - as strings. Objects have in addition access to client data via pointers.

A single version of the extended Tcl interpreter will exist - obsh, which will contain all new commands. This does not exclude there being test versions which exist for debugging purposes.


next up previous
Next: Commands Up: Interactive Scripting Language Previous: Interactive Scripting Language
Mike Gaylard
1999-06-14