next up previous contents
Next: The XSPEC Parser Up: Tcl Previous: XSPEC command result

Unknown Procedure

Tcl provides a facility whereby if it cannot match an entered command to its list of known commands, it calls the unknown procedure, with the unmatched command (along with its arguments) as its argument. The version of init.tcl distributed with Tcl contains a version of the unknown procedure. When Tcl initializes, it looks in several standard places for a script file named init.tcl, which it executes if found. The unknown procedure is where Tcl does command completion and automatic shell command execution.

XSPEC has its own special version of the unknown procedure, which it uses to implement some of the interactive features of XSPEC, most notably the prompting for parameter specifications in commands such as model and setpar. At start up time, XSPEC loads its own unknown procedure, and renames the current unknown procedure to tcl_unknown. If XSPEC is not doing any special processing, it simply passes any unmatched commands onto tcl_unknown, which then processes them as usual.

These factors need to be taken into consideration for programmers writing Tcl scripts for use within XSPEC. For example, if after initialization, a programmer should want to load a different version of the standard Tcl unknown procedure, she should name that procedure tcl_unknown, rather than unknown. Otherwise, XSPEC commands such as model will no longer function properly.



Keith Arnaud (kaa@genji.gsfc.nasa.gov)
Wed May 28 10:59:33 EDT 1997